44 #ifndef ROL_FLETCHERSTEP_H
45 #define ROL_FLETCHERSTEP_H
52 #include "ROL_ParameterList.hpp"
66 ROL::Ptr<BoundConstraint<Real> >
bnd_;
70 ROL::Ptr<Vector<Real> >
x_;
88 ROL::Ptr<Vector<Real> >
g_;
128 Real
zero(0), one(1), two(2), oe8(1.e8), oe1(1.e-1), oem6(1e-6), oem8(1.e-8);
130 ROL::ParameterList& sublist = parlist.sublist(
"Step").sublist(
"Fletcher");
132 delta_ = sublist.get(
"Regularization Parameter",
zero);
133 deltaMin_ = sublist.get(
"Min Regularization Parameter",oem8);
134 deltaUpdate_ = sublist.get(
"Regularization Parameter Decrease Factor", oe1);
136 penaltyUpdate_ = sublist.get(
"Penalty Parameter Growth Factor", two);
141 subStep_ = sublist.get(
"Subproblem Solver",
"Trust Region");
151 bnd_ = ROL::makePtr<BoundConstraint<Real>>();
164 ROL::ParameterList trlist(
parlist_);
165 bool inexactFletcher = trlist.sublist(
"Step").sublist(
"Fletcher").get(
"Inexact Solves",
false);
166 if( inexactFletcher ) {
167 trlist.sublist(
"General").set(
"Inexact Objective Value",
true);
168 trlist.sublist(
"General").set(
"Inexact Gradient",
true);
171 trlist.sublist(
"Step").sublist(
"Trust Region").set(
"Subproblem Model",
"Coleman-Li");
175 step_ = makePtr<LineSearchStep<Real>>(trlist);
178 step_ = makePtr<TrustRegionStep<Real>>(trlist);
197 state->descentVec = x.
clone();
198 state->gradientVec = g.
clone();
199 state->constraintVec = c.
clone();
201 algo_state.
nfval = 0;
202 algo_state.
ncval = 0;
203 algo_state.
ngrad = 0;
211 algo_state.
cnorm = (state->constraintVec)->norm();
252 bool modified =
false;
256 const ROL::Ptr<const StepState<Real> > state =
step_->getStepState();
262 Real cnorm = (fletcherState->constraintVec)->norm();
263 bool too_infeasible = cnorm >
static_cast<Real
>(100.)*gPhiNorm;
264 bool too_feasible = cnorm < static_cast<Real>(1e-2)*gPhiNorm;
270 algo_state.
flag =
true;
284 algo_state.
flag =
true;
296 if( gPhiNorm < deltaNext ) {
306 Real tol =
static_cast<Real
>(1e-12);
322 fletcherState->descentVec->set(s);
329 algo_state.
cnorm = (fletcherState->constraintVec)->norm();
351 std::stringstream hist;
354 hist << std::setw(6) << std::left <<
"iter";
355 hist << std::setw(15) << std::left <<
"merit";
356 hist << std::setw(15) << std::left <<
"fval";
357 hist << std::setw(15) << std::left <<
"gpnorm";
358 hist << std::setw(15) << std::left <<
"gLnorm";
359 hist << std::setw(15) << std::left <<
"cnorm";
360 hist << std::setw(15) << std::left <<
"snorm";
361 hist << std::setw(15) << std::left <<
"tr_radius";
362 hist << std::setw(10) << std::left <<
"tr_flag";
364 hist << std::setw(10) << std::left <<
"iterCG";
365 hist << std::setw(10) << std::left <<
"flagCG";
367 hist << std::setw(15) << std::left <<
"penalty";
368 hist << std::setw(15) << std::left <<
"delta";
369 hist << std::setw(10) << std::left <<
"#fval";
370 hist << std::setw(10) << std::left <<
"#grad";
371 hist << std::setw(10) << std::left <<
"#cval";
375 std::string stepHeader =
step_->printHeader();
378 hist << std::setw(15) << std::left <<
"fval";
379 hist << std::setw(15) << std::left <<
"gLnorm";
380 hist << std::setw(15) << std::left <<
"cnorm";
381 hist << std::setw(15) << std::left <<
"penalty";
382 hist << std::setw(15) << std::left <<
"delta";
383 hist << std::setw(10) << std::left <<
"#cval";
392 std::stringstream hist;
393 hist <<
"\n" <<
" Fletcher solver : " <<
subStep_;
402 stepHist.erase(std::remove(stepHist.end()-3, stepHist.end(),
'\n'), stepHist.end());
403 std::string name =
step_->printName();
404 size_t pos = stepHist.find(name);
405 if ( pos != std::string::npos ) {
406 stepHist.erase(pos, name.length());
409 std::stringstream hist;
410 hist << std::scientific << std::setprecision(6);
411 if ( algo_state.
iter == 0 ) {
423 hist << std::setw(6) << std::left << algo_state.
iter;
425 hist << std::setw(15) << std::left << algo_state.
value;
427 hist << std::setw(15) << std::left << algo_state.
gnorm;
428 hist << std::setw(15) << std::left << algo_state.
cnorm;
429 hist << std::setw(15) << std::left << stepHist.substr(38,15);
430 hist << std::setw(15) << std::left << stepHist.substr(53,15);
431 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(88,10));
433 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(93,10));
434 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(103,10));
436 hist << std::setw(15) << std::left << penaltyString;
437 hist << std::setw(15) << std::left << deltaString;
438 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(68,10));
439 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(78,10));
440 hist << std::setw(10) << std::left << algo_state.
ncval;
444 hist << std::setw(15) << std::left << algo_state.
value;
445 hist << std::setw(15) << std::left << algo_state.
gnorm;
446 hist << std::setw(15) << std::left << algo_state.
cnorm;
447 hist << std::setw(15) << std::left << penaltyString;
448 hist << std::setw(15) << std::left << deltaString;
449 hist << std::setw(10) << std::left << algo_state.
ncval;
457 std::stringstream valString;
458 valString << std::scientific << std::setprecision(6);
460 valString << std::setw(15) << std::left <<
value;
462 valString << std::setw(15) <<
"";
464 return valString.str();
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).
Provides the interface to evaluate objective functions.
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
int getNumberGradientEvaluations() const
void setDelta(Real delta)
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
AlgorithmState< Real > tr_algo_state_
Real getObjectiveValue(const Vector< Real > &x)
bool isActivated(void) const
Check if bounds are on.
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Provides the interface to compute optimization steps.
std::string print(AlgorithmState< Real > &algo_state, bool pHeader=false) const
Print iterate status.
void compute(Vector< Real > &s, const Vector< Real > &x, const Vector< Real > &l, Objective< Real > &obj, Constraint< Real > &con, AlgorithmState< Real > &algo_state)
Compute step (equality constraint).
Real aggregateGradientNorm
Contains definitions of custom data types in ROL.
const Ptr< Vector< Real > > getMultiplierVec(const Vector< Real > &x)
ROL::Objective_SimOpt value
int getNumberFunctionEvaluations() const
FletcherStep(ROL::ParameterList &parlist)
void update(Vector< Real > &x, Vector< Real > &l, const Vector< Real > &s, Objective< Real > &obj, Constraint< Real > &con, AlgorithmState< Real > &algo_state)
Update step, if successful (equality constraint).
Defines the linear algebra or vector space interface.
ROL::Ptr< BoundConstraint< Real > > bnd_
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
State for algorithm class. Will be used for restarts.
ROL::Ptr< Vector< Real > > x_
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
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).
void setPenaltyParameter(Real sigma)
ROL::Ptr< StepState< Real > > getState(void)
const Ptr< Vector< Real > > getConstraintVec(const Vector< Real > &x)
ROL::ParameterList parlist_
Real computeProjGradientNorm(const Vector< Real > &g, const Vector< Real > &x, BoundConstraint< Real > &bnd)
ROL::Ptr< Vector< Real > > iterateVec
ROL::Ptr< Vector< Real > > g_
Provides the interface to compute Fletcher steps.
std::string getValueString(const Real value, const bool print) const
void update(Vector< Real > &x, const Vector< Real > &s, Objective< Real > &obj, BoundConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Update step, for bound constraints; here only to satisfy the interface requirements, does nothing, needs refactoring.
int getNumberConstraintEvaluations() const
std::string printName(void) const
Print step name.
Provides the interface to apply upper and lower bound constraints.
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 and bound constraints.
const Ptr< Vector< Real > > getLagrangianGradient(const Vector< Real > &x)
std::string printHeader(void) const
Print iterate header.
ETrustRegion StringToETrustRegion(std::string s)
ROL::Ptr< Vector< Real > > lagmultVec
void compute(Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Compute step for bound constraints; here only to satisfy the interface requirements, does nothing, needs refactoring.
virtual Real norm() const =0
Returns where .
ETrustRegion
Enumeration of trust-region solver types.
void initialize(Vector< Real > &x, const Vector< Real > &g, Vector< Real > &l, const Vector< Real > &c, Objective< Real > &obj, Constraint< Real > &con, AlgorithmState< Real > &algo_state)
Initialize step with equality constraint.
ROL::Ptr< Step< Real > > step_
Defines the general constraint operator interface.
virtual void project(Vector< Real > &x)
Project optimization variables onto the bounds.
const ROL::Ptr< const StepState< Real > > getStepState(void) const
Get state for step object.