10#ifndef ROL_MOREAUYOSIDAPENALTYSTEP_H
11#define ROL_MOREAUYOSIDAPENALTYSTEP_H
24#include "ROL_ParameterList.hpp"
98 ROL::Ptr<Algorithm<Real>>
algo_;
99 ROL::Ptr<Vector<Real>>
x_;
100 ROL::Ptr<Vector<Real>>
g_;
101 ROL::Ptr<Vector<Real>>
l_;
102 ROL::Ptr<BoundConstraint<Real>>
bnd_;
130 myPen.
gradient(*(state->gradientVec), x, zerotol);
132 state->gradientVec->plus(*
g_);
133 gLnorm_ = (state->gradientVec)->norm();
135 con.
value(*(state->constraintVec),x, zerotol);
136 algo_state.
cnorm = (state->constraintVec)->norm();
157 myPen.
gradient(*(state->gradientVec), x, zerotol);
158 gLnorm_ = (state->gradientVec)->norm();
160 algo_state.
cnorm =
static_cast<Real
>(0);
182 Real ten(10), oem6(1.e-6), oem8(1.e-8);
183 ROL::ParameterList& steplist = parlist.sublist(
"Step").sublist(
"Moreau-Yosida Penalty");
185 tau_ = steplist.get(
"Penalty Parameter Growth Factor",ten);
187 print_ = steplist.sublist(
"Subproblem").get(
"Print History",
false);
189 Real gtol = steplist.sublist(
"Subproblem").get(
"Optimality Tolerance",oem8);
190 Real ctol = steplist.sublist(
"Subproblem").get(
"Feasibility Tolerance",oem8);
191 Real stol = oem6*std::min(gtol,ctol);
192 int maxit = steplist.sublist(
"Subproblem").get(
"Iteration Limit",1000);
193 parlist_.sublist(
"Status Test").set(
"Gradient Tolerance", gtol);
194 parlist_.sublist(
"Status Test").set(
"Constraint Tolerance", ctol);
195 parlist_.sublist(
"Status Test").set(
"Step Tolerance", stol);
196 parlist_.sublist(
"Status Test").set(
"Iteration Limit", maxit);
198 stepname_ = steplist.sublist(
"Subproblem").get(
"Step Type",
"Composite Step");
210 state->descentVec = x.
clone();
211 state->gradientVec = g.
clone();
212 state->constraintVec = c.
clone();
222 algo_state.
nfval = 0;
223 algo_state.
ncval = 0;
224 algo_state.
ngrad = 0;
235 state->descentVec = x.
clone();
236 state->gradientVec = g.
clone();
245 algo_state.
nfval = 0;
246 algo_state.
ncval = 0;
247 algo_state.
ngrad = 0;
250 bnd_ = ROL::makePtr<BoundConstraint<Real>>();
263 Ptr<Objective<Real>> penObj;
265 Ptr<Objective<Real>> raw_obj = makePtrFromRef(obj);
266 Ptr<Constraint<Real>> raw_con = makePtrFromRef(con);
268 penObj = makePtr<AugmentedLagrangian<Real>>(raw_obj,raw_con,l,one,x,*(state->constraintVec),
parlist_);
272 Ptr<Objective<Real>> raw_obj = makePtrFromRef(obj);
273 Ptr<Constraint<Real>> raw_con = makePtrFromRef(con);
275 penObj = makePtr<Fletcher<Real>>(raw_obj,raw_con,x,*(state->constraintVec),
parlist_);
279 penObj = makePtrFromRef(obj);
286 x_->set(x);
l_->set(l);
330 state->descentVec->set(s);
342 state->searchSize *=
tau_;
347 algo_state.
ncval += (
algo_->getState())->ncval;
361 state->descentVec->set(s);
371 state->searchSize *=
tau_;
383 std::stringstream hist;
385 hist << std::setw(6) << std::left <<
"iter";
386 hist << std::setw(15) << std::left <<
"fval";
388 hist << std::setw(15) << std::left <<
"cnorm";
390 hist << std::setw(15) << std::left <<
"gnorm";
391 hist << std::setw(15) << std::left <<
"ifeas";
392 hist << std::setw(15) << std::left <<
"snorm";
393 hist << std::setw(10) << std::left <<
"penalty";
394 hist << std::setw(8) << std::left <<
"#fval";
395 hist << std::setw(8) << std::left <<
"#grad";
397 hist << std::setw(8) << std::left <<
"#cval";
399 hist << std::setw(8) << std::left <<
"subIter";
407 std::stringstream hist;
408 hist <<
"\n" <<
" Moreau-Yosida Penalty solver";
416 std::stringstream hist;
417 hist << std::scientific << std::setprecision(6);
418 if ( algo_state.
iter == 0 ) {
424 if ( algo_state.
iter == 0 ) {
426 hist << std::setw(6) << std::left << algo_state.
iter;
427 hist << std::setw(15) << std::left << algo_state.
value;
429 hist << std::setw(15) << std::left << algo_state.
cnorm;
431 hist << std::setw(15) << std::left <<
gLnorm_;
433 hist << std::setw(15) << std::left <<
" ";
434 hist << std::scientific << std::setprecision(2);
435 hist << std::setw(10) << std::left << Step<Real>::getStepState()->searchSize;
440 hist << std::setw(6) << std::left << algo_state.
iter;
441 hist << std::setw(15) << std::left << algo_state.
value;
443 hist << std::setw(15) << std::left << algo_state.
cnorm;
445 hist << std::setw(15) << std::left <<
gLnorm_;
447 hist << std::setw(15) << std::left << algo_state.
snorm;
448 hist << std::scientific << std::setprecision(2);
449 hist << std::setw(10) << std::left << Step<Real>::getStepState()->searchSize;
450 hist << std::scientific << std::setprecision(6);
451 hist << std::setw(8) << std::left << algo_state.
nfval;
452 hist << std::setw(8) << std::left << algo_state.
ngrad;
454 hist << std::setw(8) << std::left << algo_state.
ncval;
virtual void update(const Vector< Real > &u_old, const Vector< Real > &u_new, const Vector< Real > &z, bool flag=true, int iter=-1)
virtual void initialize(const Vector< Real > &x)
Initialize temporary variables.
Contains definitions of custom data types in ROL.
Provides the interface to compute augmented Lagrangian steps.
Provides the interface to apply upper and lower bound constraints.
bool isActivated(void) const
Check if bounds are on.
virtual void project(Vector< Real > &x)
Project optimization variables onto the bounds.
Defines the general constraint operator interface.
virtual void value(Vector< Real > &c, const Vector< Real > &x, Real &tol)=0
Evaluate the constraint operator at .
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update constraint function.
virtual void applyAdjointJacobian(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply the adjoint of the the constraint Jacobian at , , to vector .
void initialize(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Initialize step without equality constraint.
ROL::ParameterList parlist_
MoreauYosidaPenaltyStep(ROL::ParameterList &parlist)
void compute(Vector< Real > &s, const Vector< Real > &x, const Vector< Real > &l, Objective< Real > &obj, Constraint< Real > &con, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Compute step (equality and bound constraints).
~MoreauYosidaPenaltyStep()
ROL::Ptr< Step< Real > > step_
void updateState(const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
ROL::Ptr< Vector< Real > > l_
void update(Vector< Real > &x, const Vector< Real > &s, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Update step, for bound constraints.
ROL::Ptr< BoundConstraint< Real > > bnd_
ROL::Ptr< Vector< Real > > x_
void update(Vector< Real > &x, Vector< Real > &l, const Vector< Real > &s, Objective< Real > &obj, Constraint< Real > &con, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Update step, if successful (equality and bound constraints).
void updateState(const Vector< Real > &x, const Vector< Real > &l, Objective< Real > &obj, Constraint< Real > &con, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
std::string printHeader(void) const
Print iterate header.
void initialize(Vector< Real > &x, const Vector< Real > &g, Vector< Real > &l, const Vector< Real > &c, Objective< Real > &obj, Constraint< Real > &con, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Initialize step with equality constraint.
std::string print(AlgorithmState< Real > &algo_state, bool pHeader=false) const
Print iterate status.
void compute(Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Compute step for bound constraints.
std::string printName(void) const
Print step name.
ROL::Ptr< Algorithm< Real > > algo_
ROL::Ptr< Vector< Real > > g_
ROL::Ptr< StatusTest< Real > > status_
Provides the interface to evaluate the Moreau-Yosida penalty function.
Real testComplementarity(const ROL::Vector< Real > &x)
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update Moreau-Yosida penalty function.
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
Real value(const Vector< Real > &x, Real &tol)
Compute value.
int getNumberFunctionEvaluations(void)
int getNumberGradientEvaluations(void)
void updateMultipliers(Real mu, const ROL::Vector< Real > &x)
Provides the interface to evaluate objective functions.
Provides the interface to compute optimization steps.
ROL::Ptr< StepState< Real > > getState(void)
Defines the linear algebra or vector space interface.
virtual Real norm() const =0
Returns where .
virtual void set(const Vector &x)
Set where .
virtual void plus(const Vector &x)=0
Compute , where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.
@ STEP_AUGMENTEDLAGRANGIAN
EStep StringToEStep(std::string s)
State for algorithm class. Will be used for restarts.
ROL::Ptr< Vector< Real > > lagmultVec
ROL::Ptr< Vector< Real > > iterateVec