44 #ifndef ROL_MOREAUYOSIDAPENALTY_H 45 #define ROL_MOREAUYOSIDAPENALTY_H 51 #include "Teuchos_RCP.hpp" 67 const Teuchos::RCP<Objective<Real> >
obj_;
68 const Teuchos::RCP<BoundConstraint<Real> >
con_;
70 Teuchos::RCP<Vector<Real> >
g_;
71 Teuchos::RCP<Vector<Real> >
l_;
72 Teuchos::RCP<Vector<Real> >
u_;
73 Teuchos::RCP<Vector<Real> >
l1_;
74 Teuchos::RCP<Vector<Real> >
u1_;
75 Teuchos::RCP<Vector<Real> >
dl1_;
76 Teuchos::RCP<Vector<Real> >
du1_;
77 Teuchos::RCP<Vector<Real> >
xlam_;
78 Teuchos::RCP<Vector<Real> >
v_;
79 Teuchos::RCP<Vector<Real> >
dv_;
80 Teuchos::RCP<Vector<Real> >
dv2_;
81 Teuchos::RCP<Vector<Real> >
lam_;
82 Teuchos::RCP<Vector<Real> >
tmp_;
93 if ( con_->isActivated() ) {
95 if ( !isConEvaluated_ ) {
97 xlam_->axpy(one/mu_,*lam_);
99 if ( con_->isFeasible(*xlam_) ) {
100 l1_->zero(); dl1_->zero();
101 u1_->zero(); du1_->zero();
106 con_->pruneLowerInactive(*l1_,*xlam_);
108 con_->pruneLowerInactive(*tmp_,*xlam_);
109 l1_->axpy(-one,*tmp_);
113 con_->pruneUpperInactive(*u1_,*xlam_);
115 con_->pruneUpperInactive(*tmp_,*xlam_);
116 u1_->axpy(-one,*tmp_);
119 dl1_->set(l1_->dual());
120 con_->pruneLowerInactive(*dl1_,*xlam_);
123 du1_->set(u1_->dual());
124 con_->pruneUpperInactive(*du1_,*xlam_);
127 isConEvaluated_ =
true;
134 g_ = x.
dual().clone();
137 dl1_ = x.
dual().clone();
140 du1_ = x.
dual().clone();
143 dv_ = x.
dual().clone();
144 dv2_ = x.
dual().clone();
148 con_->setVectorToLowerBound(*l_);
149 con_->setVectorToUpperBound(*u_);
164 : obj_(obj), con_(con), mu_(mu),
165 fval_(0), isConEvaluated_(false), nfval_(0), ngval_(0),
166 updateMultiplier_(true), updatePenalty_(true) {
173 Teuchos::ParameterList &parlist)
174 : obj_(obj), con_(con),
175 fval_(0), isConEvaluated_(false), nfval_(0), ngval_(0) {
177 Teuchos::ParameterList &list = parlist.sublist(
"Step").sublist(
"Moreau-Yosida Penalty");
178 updateMultiplier_ = list.get(
"Update Multiplier",
true);
179 updatePenalty_ = list.get(
"Update Penalty",
true);
180 mu_ = list.get(
"Initial Penalty Parameter",1e1);
187 Teuchos::ParameterList &parlist)
188 : obj_(obj), con_(con),
189 fval_(0), isConEvaluated_(false), nfval_(0), ngval_(0) {
192 Teuchos::ParameterList &list = parlist.sublist(
"Step").sublist(
"Moreau-Yosida Penalty");
193 updateMultiplier_ = list.get(
"Update Multiplier",
true);
194 updatePenalty_ = list.get(
"Update Penalty",
true);
195 mu_ = list.get(
"Initial Penalty Parameter",1e1);
199 if ( con_->isActivated() ) {
200 if ( updateMultiplier_ ) {
204 lam_->axpy(-one,*l1_);
207 if ( updatePenalty_ ) {
211 nfval_ = 0; ngval_ = 0;
212 isConEvaluated_ =
false;
217 if (con_->isActivated()) {
221 tmp_->axpy(static_cast<Real>(-1), *l_);
222 Real lower = mu_*std::abs(tmp_->dot(*l1_));
225 tmp_->axpy(static_cast<Real>(-1), *u_);
226 Real upper = mu_*std::abs(tmp_->dot(*u1_));
229 con_->project(*tmp_);
230 tmp_->axpy(static_cast<Real>(-1), x);
231 Real xnorm = tmp_->norm();
233 val = std::max(xnorm,std::max(lower,upper));
262 obj_->update(x,flag,iter);
263 con_->update(x,flag,iter);
264 isConEvaluated_ =
false;
276 fval_ = obj_->value(x,tol);
280 if ( con_->isActivated() ) {
282 fval += half*mu_*(l1_->dot(*l1_) + u1_->dot(*u1_));
296 obj_->gradient(*g_,x,tol);
300 if ( con_->isActivated() ) {
317 obj_->hessVec(hv,v,x,tol);
319 if ( con_->isActivated() ) {
324 con_->pruneLowerActive(*v_,*xlam_);
327 dv_->set(v_->dual());
329 con_->pruneLowerActive(*dv_,*xlam_);
335 con_->pruneUpperActive(*v_,*xlam_);
338 dv_->set(v_->dual());
340 con_->pruneUpperActive(*dv_,*xlam_);
351 obj_->setParameter(param);
Provides the interface to evaluate objective functions.
const Teuchos::RCP< Objective< Real > > obj_
Teuchos::RCP< Vector< Real > > g_
MoreauYosidaPenalty(const Teuchos::RCP< Objective< Real > > &obj, const Teuchos::RCP< BoundConstraint< Real > > &con, const ROL::Vector< Real > &x, const Real mu=1e1)
void setParameter(const std::vector< Real > ¶m)
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Teuchos::RCP< Vector< Real > > dv_
int getNumberGradientEvaluations(void)
Teuchos::RCP< Vector< Real > > xlam_
Contains definitions of custom data types in ROL.
Teuchos::RCP< Vector< Real > > v_
Real value(const Vector< Real > &x, Real &tol)
Compute value.
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
void updateMultipliers(Real mu, const ROL::Vector< Real > &x)
Defines the linear algebra or vector space interface.
Teuchos::RCP< Vector< Real > > dv2_
void initialize(const ROL::Vector< Real > &x, const Teuchos::RCP< ROL::BoundConstraint< Real > > &con)
Teuchos::RCP< Vector< Real > > tmp_
void computePenalty(const Vector< Real > &x)
Teuchos::RCP< Vector< Real > > u_
Teuchos::RCP< Vector< Real > > l_
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
Teuchos::RCP< Vector< Real > > du1_
Teuchos::RCP< Vector< Real > > getGradient(void) const
MoreauYosidaPenalty(const Teuchos::RCP< Objective< Real > > &obj, const Teuchos::RCP< BoundConstraint< Real > > &con, const ROL::Vector< Real > &x, Teuchos::ParameterList &parlist)
Provides the interface to evaluate the Moreau-Yosida penalty function.
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
Provides the interface to apply upper and lower bound constraints.
MoreauYosidaPenalty(const Teuchos::RCP< Objective< Real > > &obj, const Teuchos::RCP< BoundConstraint< Real > > &con, const ROL::Vector< Real > &x, const ROL::Vector< Real > &lam, Teuchos::ParameterList &parlist)
const Teuchos::RCP< BoundConstraint< Real > > con_
int getNumberFunctionEvaluations(void)
Teuchos::RCP< Vector< Real > > lam_
virtual void setParameter(const std::vector< Real > ¶m)
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update Moreau-Yosida penalty function.
Teuchos::RCP< Vector< Real > > u1_
virtual void set(const Vector &x)
Set where .
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
Real getObjectiveValue(void) const
Teuchos::RCP< Vector< Real > > dl1_
Real testComplementarity(const ROL::Vector< Real > &x)
Teuchos::RCP< Vector< Real > > l1_