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_;
91 if ( con_->isActivated() ) {
93 if ( !isConEvaluated_ ) {
95 xlam_->axpy(one/mu_,*lam_);
97 if ( con_->isFeasible(*xlam_) ) {
98 l1_->zero(); dl1_->zero();
99 u1_->zero(); du1_->zero();
104 con_->pruneLowerInactive(*l1_,*xlam_);
106 con_->pruneLowerInactive(*tmp_,*xlam_);
107 l1_->axpy(-one,*tmp_);
111 con_->pruneUpperInactive(*u1_,*xlam_);
113 con_->pruneUpperInactive(*tmp_,*xlam_);
114 u1_->axpy(-one,*tmp_);
117 dl1_->set(l1_->dual());
118 con_->pruneLowerInactive(*dl1_,*xlam_);
121 du1_->set(u1_->dual());
122 con_->pruneUpperInactive(*du1_,*xlam_);
125 isConEvaluated_ =
true;
136 : obj_(obj), con_(con), mu_(mu),
137 fval_(0), isConEvaluated_(false), nfval_(0), ngval_(0) {
139 g_ = x.
dual().clone();
142 dl1_ = x.
dual().clone();
145 du1_ = x.
dual().clone();
148 dv_ = x.
dual().clone();
149 dv2_ = x.
dual().clone();
153 con_->setVectorToLowerBound(*l_);
154 con_->setVectorToUpperBound(*u_);
163 if ( con_->isActivated() ) {
168 lam_->axpy(-one,*l1_);
174 nfval_ = 0; ngval_ = 0;
175 isConEvaluated_ =
false;
202 obj_->update(x,flag,iter);
203 con_->update(x,flag,iter);
204 isConEvaluated_ =
false;
216 fval_ = obj_->value(x,tol);
220 if ( con_->isActivated() ) {
222 fval += half*mu_*(l1_->dot(*l1_) + u1_->dot(*u1_));
236 obj_->gradient(*g_,x,tol);
240 if ( con_->isActivated() ) {
257 obj_->hessVec(hv,v,x,tol);
259 if ( con_->isActivated() ) {
264 con_->pruneLowerActive(*v_,*xlam_);
267 dv_->set(v_->dual());
269 con_->pruneLowerActive(*dv_,*xlam_);
275 con_->pruneUpperActive(*v_,*xlam_);
278 dv_->set(v_->dual());
280 con_->pruneUpperActive(*dv_,*xlam_);
291 obj_->setParameter(param);
Provides the interface to evaluate objective functions.
const Teuchos::RCP< Objective< Real > > obj_
Teuchos::RCP< Vector< Real > > g_
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_
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, const Real mu=1.0)
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.
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_
Teuchos::RCP< Vector< Real > > l1_