44#ifndef ROL_FLETCHERSTEP_H
45#define ROL_FLETCHERSTEP_H
52#include "ROL_ParameterList.hpp"
65 ROL::Ptr<BoundConstraint<Real> >
bnd_;
69 ROL::Ptr<Vector<Real> >
x_;
87 ROL::Ptr<Vector<Real> >
g_;
127 Real
zero(0), one(1), two(2), oe8(1.e8), oe1(1.e-1), oem6(1e-6), oem8(1.e-8);
129 ROL::ParameterList& sublist = parlist.sublist(
"Step").sublist(
"Fletcher");
131 delta_ = sublist.get(
"Regularization Parameter",
zero);
132 deltaMin_ = sublist.get(
"Min Regularization Parameter",oem8);
133 deltaUpdate_ = sublist.get(
"Regularization Parameter Decrease Factor", oe1);
135 penaltyUpdate_ = sublist.get(
"Penalty Parameter Growth Factor", two);
140 subStep_ = sublist.get(
"Subproblem Solver",
"Trust Region");
150 bnd_ = ROL::makePtr<BoundConstraint<Real>>();
163 ROL::ParameterList trlist(
parlist_);
164 bool inexactFletcher = trlist.sublist(
"Step").sublist(
"Fletcher").get(
"Inexact Solves",
false);
165 if( inexactFletcher ) {
166 trlist.sublist(
"General").set(
"Inexact Objective Value",
true);
167 trlist.sublist(
"General").set(
"Inexact Gradient",
true);
170 trlist.sublist(
"Step").sublist(
"Trust Region").set(
"Subproblem Model",
"Coleman-Li");
174 step_ = makePtr<LineSearchStep<Real>>(trlist);
177 step_ = makePtr<TrustRegionStep<Real>>(trlist);
196 state->descentVec = x.
clone();
197 state->gradientVec = g.
clone();
198 state->constraintVec = c.
clone();
200 algo_state.
nfval = 0;
201 algo_state.
ncval = 0;
202 algo_state.
ngrad = 0;
210 algo_state.
cnorm = (state->constraintVec)->norm();
251 bool modified =
false;
255 const ROL::Ptr<const StepState<Real> > state =
step_->getStepState();
261 Real cnorm = (fletcherState->constraintVec)->norm();
262 bool too_infeasible = cnorm >
static_cast<Real
>(100.)*gPhiNorm;
263 bool too_feasible = cnorm < static_cast<Real>(1e-2)*gPhiNorm;
269 algo_state.
flag =
true;
283 algo_state.
flag =
true;
295 if( gPhiNorm < deltaNext ) {
305 Real tol =
static_cast<Real
>(1e-12);
321 fletcherState->descentVec->set(s);
328 algo_state.
cnorm = (fletcherState->constraintVec)->norm();
349 std::stringstream hist;
352 hist << std::setw(6) << std::left <<
"iter";
353 hist << std::setw(15) << std::left <<
"merit";
354 hist << std::setw(15) << std::left <<
"fval";
355 hist << std::setw(15) << std::left <<
"gpnorm";
356 hist << std::setw(15) << std::left <<
"gLnorm";
357 hist << std::setw(15) << std::left <<
"cnorm";
358 hist << std::setw(15) << std::left <<
"snorm";
359 hist << std::setw(15) << std::left <<
"tr_radius";
360 hist << std::setw(10) << std::left <<
"tr_flag";
362 hist << std::setw(10) << std::left <<
"iterCG";
363 hist << std::setw(10) << std::left <<
"flagCG";
365 hist << std::setw(15) << std::left <<
"penalty";
366 hist << std::setw(15) << std::left <<
"delta";
367 hist << std::setw(10) << std::left <<
"#fval";
368 hist << std::setw(10) << std::left <<
"#grad";
369 hist << std::setw(10) << std::left <<
"#cval";
373 std::string stepHeader =
step_->printHeader();
376 hist << std::setw(15) << std::left <<
"fval";
377 hist << std::setw(15) << std::left <<
"gLnorm";
378 hist << std::setw(15) << std::left <<
"cnorm";
379 hist << std::setw(15) << std::left <<
"penalty";
380 hist << std::setw(15) << std::left <<
"delta";
381 hist << std::setw(10) << std::left <<
"#cval";
390 std::stringstream hist;
391 hist <<
"\n" <<
" Fletcher solver : " <<
subStep_;
400 stepHist.erase(std::remove(stepHist.end()-3, stepHist.end(),
'\n'), stepHist.end());
401 std::string name =
step_->printName();
402 size_t pos = stepHist.find(name);
403 if ( pos != std::string::npos ) {
404 stepHist.erase(pos, name.length());
407 std::stringstream hist;
408 hist << std::scientific << std::setprecision(6);
409 if ( algo_state.
iter == 0 ) {
421 hist << std::setw(6) << std::left << algo_state.
iter;
423 hist << std::setw(15) << std::left << algo_state.
value;
425 hist << std::setw(15) << std::left << algo_state.
gnorm;
426 hist << std::setw(15) << std::left << algo_state.
cnorm;
427 hist << std::setw(15) << std::left << stepHist.substr(38,15);
428 hist << std::setw(15) << std::left << stepHist.substr(53,15);
429 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(88,10));
431 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(93,10));
432 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(103,10));
434 hist << std::setw(15) << std::left << penaltyString;
435 hist << std::setw(15) << std::left << deltaString;
436 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(68,10));
437 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(78,10));
438 hist << std::setw(10) << std::left << algo_state.
ncval;
442 hist << std::setw(15) << std::left << algo_state.
value;
443 hist << std::setw(15) << std::left << algo_state.
gnorm;
444 hist << std::setw(15) << std::left << algo_state.
cnorm;
445 hist << std::setw(15) << std::left << penaltyString;
446 hist << std::setw(15) << std::left << deltaString;
447 hist << std::setw(10) << std::left << algo_state.
ncval;
455 std::stringstream valString;
456 valString << std::scientific << std::setprecision(6);
458 valString << std::setw(15) << std::left <<
value;
460 valString << std::setw(15) <<
"";
462 return valString.str();
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
Contains definitions of custom data types in ROL.
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.
const Ptr< Vector< Real > > getLagrangianGradient(const Vector< Real > &x)
int getNumberConstraintEvaluations() const
int getNumberGradientEvaluations() const
void setDelta(Real delta)
const Ptr< Vector< Real > > getMultiplierVec(const Vector< Real > &x)
Real getObjectiveValue(const Vector< Real > &x)
int getNumberFunctionEvaluations() const
const Ptr< Vector< Real > > getConstraintVec(const Vector< Real > &x)
void setPenaltyParameter(Real sigma)
Provides the interface to compute Fletcher steps.
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).
std::string printHeader(void) const
Print iterate header.
ROL::Ptr< BoundConstraint< Real > > bnd_
ROL::ParameterList parlist_
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,...
FletcherStep(ROL::ParameterList &parlist)
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).
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,...
ROL::Ptr< Step< Real > > step_
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.
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.
std::string getValueString(const Real value, const bool print) const
std::string printName(void) const
Print step name.
Real computeProjGradientNorm(const Vector< Real > &g, const Vector< Real > &x, BoundConstraint< Real > &bnd)
std::string print(AlgorithmState< Real > &algo_state, bool pHeader=false) const
Print iterate status.
ROL::Ptr< Vector< Real > > g_
AlgorithmState< Real > tr_algo_state_
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 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).
ROL::Ptr< Vector< Real > > x_
Provides the interface to evaluate objective functions.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Provides the interface to compute optimization steps.
ROL::Ptr< StepState< Real > > getState(void)
const ROL::Ptr< const StepState< Real > > getStepState(void) const
Get state for step object.
Defines the linear algebra or vector space interface.
virtual Real norm() const =0
Returns where .
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis,...
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
ROL::Objective_SerialSimOpt Objective_SimOpt value(const V &u, const V &z, Real &tol) override
ETrustRegion StringToETrustRegion(std::string s)
@ TRUSTREGION_TRUNCATEDCG
State for algorithm class. Will be used for restarts.
Real aggregateGradientNorm
ROL::Ptr< Vector< Real > > lagmultVec
ROL::Ptr< Vector< Real > > iterateVec