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();
350 std::stringstream hist;
353 hist << std::setw(6) << std::left <<
"iter";
354 hist << std::setw(15) << std::left <<
"merit";
355 hist << std::setw(15) << std::left <<
"fval";
356 hist << std::setw(15) << std::left <<
"gpnorm";
357 hist << std::setw(15) << std::left <<
"gLnorm";
358 hist << std::setw(15) << std::left <<
"cnorm";
359 hist << std::setw(15) << std::left <<
"snorm";
360 hist << std::setw(15) << std::left <<
"tr_radius";
361 hist << std::setw(10) << std::left <<
"tr_flag";
363 hist << std::setw(10) << std::left <<
"iterCG";
364 hist << std::setw(10) << std::left <<
"flagCG";
366 hist << std::setw(15) << std::left <<
"penalty";
367 hist << std::setw(15) << std::left <<
"delta";
368 hist << std::setw(10) << std::left <<
"#fval";
369 hist << std::setw(10) << std::left <<
"#grad";
370 hist << std::setw(10) << std::left <<
"#cval";
374 std::string stepHeader =
step_->printHeader();
377 hist << std::setw(15) << std::left <<
"fval";
378 hist << std::setw(15) << std::left <<
"gLnorm";
379 hist << std::setw(15) << std::left <<
"cnorm";
380 hist << std::setw(15) << std::left <<
"penalty";
381 hist << std::setw(15) << std::left <<
"delta";
382 hist << std::setw(10) << std::left <<
"#cval";
391 std::stringstream hist;
392 hist <<
"\n" <<
" Fletcher solver : " <<
subStep_;
401 stepHist.erase(std::remove(stepHist.end()-3, stepHist.end(),
'\n'), stepHist.end());
402 std::string name =
step_->printName();
403 size_t pos = stepHist.find(name);
404 if ( pos != std::string::npos ) {
405 stepHist.erase(pos, name.length());
408 std::stringstream hist;
409 hist << std::scientific << std::setprecision(6);
410 if ( algo_state.
iter == 0 ) {
422 hist << std::setw(6) << std::left << algo_state.
iter;
424 hist << std::setw(15) << std::left << algo_state.
value;
426 hist << std::setw(15) << std::left << algo_state.
gnorm;
427 hist << std::setw(15) << std::left << algo_state.
cnorm;
428 hist << std::setw(15) << std::left << stepHist.substr(38,15);
429 hist << std::setw(15) << std::left << stepHist.substr(53,15);
430 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(88,10));
432 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(93,10));
433 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(103,10));
435 hist << std::setw(15) << std::left << penaltyString;
436 hist << std::setw(15) << std::left << deltaString;
437 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(68,10));
438 hist << std::setw(10) << std::left << (algo_state.
iter == 0 ?
"" : stepHist.substr(78,10));
439 hist << std::setw(10) << std::left << algo_state.
ncval;
443 hist << std::setw(15) << std::left << algo_state.
value;
444 hist << std::setw(15) << std::left << algo_state.
gnorm;
445 hist << std::setw(15) << std::left << algo_state.
cnorm;
446 hist << std::setw(15) << std::left << penaltyString;
447 hist << std::setw(15) << std::left << deltaString;
448 hist << std::setw(10) << std::left << algo_state.
ncval;
456 std::stringstream valString;
457 valString << std::scientific << std::setprecision(6);
459 valString << std::setw(15) << std::left <<
value;
461 valString << std::setw(15) <<
"";
463 return valString.str();