44 #ifndef ROL_AUGMENTEDLAGRANGIAN_H 45 #define ROL_AUGMENTEDLAGRANGIAN_H 51 #include "Teuchos_RCP.hpp" 67 Teuchos::RCP<Objective<Real> >
obj_;
68 Teuchos::RCP<EqualityConstraint<Real> >
con_;
69 Teuchos::RCP<Vector<Real> >
lam_;
70 Teuchos::RCP<Vector<Real> >
dlam_;
71 Teuchos::RCP<Vector<Real> >
x_;
72 Teuchos::RCP<Vector<Real> >
g_;
73 Teuchos::RCP<Vector<Real> >
c_;
74 Teuchos::RCP<Vector<Real> >
dc1_;
75 Teuchos::RCP<Vector<Real> >
dc2_;
96 Teuchos::ParameterList &parlist)
97 : fval_(0.0), ncval_(0), nfval_(0), ngval_(0), penaltyParameter_(mu) {
98 obj_ = Teuchos::rcp(&obj,
false);
99 con_ = Teuchos::rcp(&con,
false);
102 g_ = x.
dual().clone();
103 dc1_ = x.
dual().clone();
110 Teuchos::ParameterList& sublist = parlist.sublist(
"Step").sublist(
"Augmented Lagrangian");
111 penaltyUpdate_ = sublist.get(
"Penalty Parameter Growth Factor", 1.e1);
112 multiplierUpdateScale_ = sublist.get(
"Multiplier Update Scale", 1.e0);
113 multiplierUpdateExponent_ = sublist.get(
"Multiplier Update Exponent", 1.e0);
114 multiplierUpdateMethod_ = sublist.get(
"Multiplier Update Method", 1);
115 scaleLagrangian_ = sublist.get(
"Use Scaled Augmented Lagrangian",
false);
116 HessianLevel_ = sublist.get(
"Level of Hessian Approximation", 0);
121 bool updated =
false;
122 if ( multiplierUpdateMethod_ == 0 ) {
123 l.
axpy(penaltyParameter,c_->dual());
125 else if ( multiplierUpdateMethod_ == 1 ) {
128 con_->solveAugmentedSystem(*x_,l,*g_,*dc2_,x,tol);
132 penaltyParameter *= ((c_->norm() < feasTolerance) ? 1. : penaltyUpdate_);
133 penaltyParameter_ = penaltyParameter;
135 if ( l.
norm() < multiplierUpdateScale_*std::pow(penaltyParameter_,multiplierUpdateExponent_) ) {
170 ncval_ = 0.; nfval_ = 0.; ngval_ = 0.;
182 obj_->update(x,flag,iter);
183 con_->update(x,flag,iter);
185 con_->value(*c_,x,tol);
188 fval_ = obj_->value(x,tol);
191 obj_->gradient(*g_,x,tol);
203 con_->value(*c_,x,tol);
206 fval_ = obj_->value(x,tol);
209 obj_->gradient(*g_,x,tol);
212 Real cval = lam_->dot(c_->dual());
214 Real pval = c_->dot(*c_);
217 if (scaleLagrangian_) {
218 val = (fval_ + cval)/penaltyParameter_ + 0.5*pval;
221 val = fval_ + cval + 0.5*penaltyParameter_*pval;
235 con_->value(*c_,x,tol);
238 fval_ = obj_->value(x,tol);
241 obj_->gradient(*g_,x,tol);
245 dlam_->set(c_->dual());
246 if ( scaleLagrangian_ ) {
247 g.
scale(1./penaltyParameter_);
248 dlam_->axpy(1./penaltyParameter_,*lam_);
251 dlam_->scale(penaltyParameter_);
254 con_->applyAdjointJacobian(*dc1_,*dlam_,x,tol);
268 con_->value(*c_,x,tol);
271 fval_ = obj_->value(x,tol);
274 obj_->gradient(*g_,x,tol);
277 obj_->hessVec(hv,v,x,tol);
278 if (HessianLevel_ < 2) {
279 con_->applyJacobian(*dc2_,v,x,tol);
280 con_->applyAdjointJacobian(*dc1_,dc2_->dual(),x,tol);
281 if (scaleLagrangian_) {
282 hv.
scale(1./penaltyParameter_);
286 hv.
axpy(penaltyParameter_,*dc1_);
289 if (HessianLevel_ == 0) {
291 dlam_->set(c_->dual());
292 if ( scaleLagrangian_ ) {
293 dlam_->axpy(1./penaltyParameter_,*lam_);
296 dlam_->scale(penaltyParameter_);
299 con_->applyAdjointHessian(*dc1_,*dlam_,v,x,tol);
Real multiplierUpdateScale_
Provides the interface to evaluate objective functions.
void getObjectiveGradient(Vector< Real > &g) const
Provides the interface to evaluate the augmented Lagrangian.
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
virtual void scale(const Real alpha)=0
Compute where .
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update augmented Lagrangian function.
virtual void plus(const Vector &x)=0
Compute , where .
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
bool updateMultipliers(Vector< Real > &l, Real &penaltyParameter, const Vector< Real > &x, const Real feasTolerance)
Teuchos::RCP< Vector< Real > > g_
void getConstraintVec(Vector< Real > &c)
Contains definitions of custom data types in ROL.
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Teuchos::RCP< Objective< Real > > obj_
Defines the linear algebra or vector space interface.
Real multiplierUpdateExponent_
Teuchos::RCP< Vector< Real > > c_
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
Teuchos::RCP< Vector< Real > > dc2_
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
Defines the equality constraint operator interface.
Teuchos::RCP< EqualityConstraint< Real > > con_
int getNumberFunctionEvaluations(void)
Real getObjectiveValue(void) const
Real value(const Vector< Real > &x, Real &tol)
Compute value.
int getNumberConstraintEvaluations(void)
Teuchos::RCP< Vector< Real > > dc1_
virtual void set(const Vector &x)
Set where .
virtual Real norm() const =0
Returns where .
int multiplierUpdateMethod_
int getNumberGradientEvaluations(void)
Teuchos::RCP< Vector< Real > > lam_
Teuchos::RCP< Vector< Real > > x_
AugmentedLagrangian(Objective< Real > &obj, EqualityConstraint< Real > &con, const Vector< Real > &x, const Vector< Real > &c, const Vector< Real > &l, const Real mu, Teuchos::ParameterList &parlist)
Teuchos::RCP< Vector< Real > > dlam_
static const double ROL_EPSILON
Platform-dependent machine epsilon.