44 #ifndef ROL_INTERIORPOINTSTEP_H
45 #define ROL_INTERIORPOINTSTEP_H
67 ROL::Ptr<Algorithm<Real> >
algo_;
68 ROL::Ptr<BoundConstraint<Real> >
bnd_;
72 ROL::Ptr<Vector<Real> >
x_;
73 ROL::Ptr<Vector<Real> >
g_;
74 ROL::Ptr<Vector<Real> >
l_;
75 ROL::Ptr<Vector<Real> >
c_;
115 using ROL::ParameterList;
117 verbosity_ = parlist.sublist(
"General").get(
"Print Verbosity",0);
120 ParameterList& iplist = parlist.sublist(
"Step").sublist(
"Interior Point");
121 mu_ = iplist.get(
"Initial Barrier Penalty",1.0);
122 mumin_ = iplist.get(
"Minimum Barrier Penalty",1.e-4);
123 mumax_ = iplist.get(
"Maximum Barrier Penalty",1e8);
124 rho_ = iplist.get(
"Barrier Penalty Reduction Factor",0.5);
127 print_ = iplist.sublist(
"Subproblem").get(
"Print History",
false);
128 Real gtol = iplist.sublist(
"Subproblem").get(
"Optimality Tolerance",1e-8);
129 Real ctol = iplist.sublist(
"Subproblem").get(
"Feasibility Tolerance",1e-8);
130 Real stol = static_cast<Real>(1e-6)*std::min(gtol,ctol);
131 int maxit = iplist.sublist(
"Subproblem").get(
"Iteration Limit",1000);
132 parlist_.sublist(
"Status Test").set(
"Gradient Tolerance", gtol);
133 parlist_.sublist(
"Status Test").set(
"Constraint Tolerance", ctol);
134 parlist_.sublist(
"Status Test").set(
"Step Tolerance", stol);
135 parlist_.sublist(
"Status Test").set(
"Iteration Limit", maxit);
137 stepname_ = iplist.sublist(
"Subproblem").get(
"Step Type",
"Composite Step");
150 state->descentVec = x.
clone();
151 state->gradientVec = g.
clone();
152 state->constraintVec = c.
clone();
162 auto& ipobj = dynamic_cast<IPOBJ&>(obj);
163 auto& ipcon = dynamic_cast<IPCON&>(con);
166 ipobj.updatePenalty(
mu_);
168 algo_state.
nfval = 0;
169 algo_state.
ncval = 0;
170 algo_state.
ngrad = 0;
182 algo_state.
nfval += ipobj.getNumberFunctionEvaluations();
183 algo_state.
ngrad += ipobj.getNumberGradientEvaluations();
184 algo_state.
ncval += ipcon.getNumberConstraintEvaluations();
206 state->descentVec = x.
clone();
207 state->gradientVec = g.
clone();
214 auto& ipobj = dynamic_cast<IPOBJ&>(obj);
215 ipobj.updatePenalty(
mu_);
217 algo_state.
nfval = 0;
218 algo_state.
ncval = 0;
219 algo_state.
ngrad = 0;
221 Real zerotol = std::sqrt(ROL_EPSILON<Real>());
228 algo_state.
cnorm = static_cast<Real>(0);
230 algo_state.
nfval += ipobj.getNumberFunctionEvaluations();
231 algo_state.
ngrad += ipobj.getNumberGradientEvaluations();
233 bnd_ = ROL::makePtr<BoundConstraint<Real>>();
253 Ptr<Objective<Real>> penObj;
255 Ptr<Objective<Real>> raw_obj = makePtrFromRef(obj);
256 Ptr<Constraint<Real>> raw_con = makePtrFromRef(con);
258 penObj = makePtr<AugmentedLagrangian<Real>>(raw_obj,raw_con,l,one,x,*(state->constraintVec),
parlist_);
261 Ptr<Objective<Real>> raw_obj = makePtrFromRef(obj);
262 Ptr<Constraint<Real>> raw_con = makePtrFromRef(con);
264 penObj = makePtr<Fletcher<Real>>(raw_obj,raw_con,x,*(state->constraintVec),
parlist_);
267 penObj = makePtrFromRef(obj);
275 x_->set(x);
l_->set(l);
290 compute(s,x,l,obj,con,algo_state);
300 auto& ipobj = dynamic_cast<IPOBJ&>(obj);
303 algo_ = ROL::makePtr<Algorithm<Real>>(
"Trust Region",
parlist_,
false);
325 auto& ipobj = dynamic_cast<IPOBJ&>(obj);
326 auto& ipcon = dynamic_cast<IPCON&>(con);
331 ipobj.updatePenalty(
mu_);
341 state->descentVec->set(s);
347 algo_state.
value = ipobj.value(x,zerotol);
348 algo_state.
value = ipobj.getObjectiveValue();
350 ipcon.value(*
c_,x,zerotol);
351 state->constraintVec->set(*
c_);
353 ipobj.gradient(*
g_,x,zerotol);
354 state->gradientVec->set(*
g_);
356 ipcon.applyAdjointJacobian(*
g_,*
l_,x,zerotol);
357 state->gradientVec->plus(*
g_);
360 algo_state.
cnorm = state->constraintVec->norm();
363 algo_state.
nfval += ipobj.getNumberFunctionEvaluations();
364 algo_state.
ngrad += ipobj.getNumberGradientEvaluations();
365 algo_state.
ncval += ipcon.getNumberConstraintEvaluations();
376 update(x,l,s,obj,con,algo_state);
380 x_->axpy(static_cast<Real>(-1),state->gradientVec->dual());
382 x_->axpy(static_cast<Real>(-1),x);
392 auto& ipobj = dynamic_cast<IPOBJ&>(obj);
397 ipobj.updatePenalty(
mu_);
406 state->descentVec->set(s);
410 Real zerotol = std::sqrt(ROL_EPSILON<Real>());
412 algo_state.
value = ipobj.value(x,zerotol);
413 algo_state.
value = ipobj.getObjectiveValue();
415 ipobj.gradient(*
g_,x,zerotol);
416 state->gradientVec->set(*
g_);
419 x_->axpy(static_cast<Real>(-1),state->gradientVec->dual());
421 x_->axpy(static_cast<Real>(-1),x);
426 algo_state.
nfval += ipobj.getNumberFunctionEvaluations();
427 algo_state.
ngrad += ipobj.getNumberGradientEvaluations();
433 std::stringstream hist;
437 hist << std::string(116,
'-') <<
"\n";
438 hist <<
"Interior Point status output definitions\n\n";
440 hist <<
" IPiter - Number of interior point steps taken\n";
441 hist <<
" SPiter - Number of subproblem solver iterations\n";
442 hist <<
" penalty - Penalty parameter multiplying the barrier objective\n";
443 hist <<
" fval - Number of objective evaluations\n";
445 hist <<
" cnorm - Norm of the composite constraint\n";
446 hist <<
" gLnorm - Norm of the Lagrangian's gradient\n";
449 hist <<
" gnorm - Norm of the projected norm of the objective gradient\n";
451 hist <<
" snorm - Norm of step (update to optimzation and slack vector)\n";
452 hist <<
" #fval - Number of objective function evaluations\n";
453 hist <<
" #grad - Number of gradient evaluations\n";
455 hist <<
" #cval - Number of composite constraint evaluations\n";
457 hist << std::string(116,
'-') <<
"\n";
461 hist << std::setw(9) << std::left <<
"IPiter";
462 hist << std::setw(9) << std::left <<
"SPiter";
463 hist << std::setw(15) << std::left <<
"penalty";
464 hist << std::setw(15) << std::left <<
"fval";
466 hist << std::setw(15) << std::left <<
"cnorm";
467 hist << std::setw(15) << std::left <<
"gLnorm";
470 hist << std::setw(15) << std::left <<
"gnorm";
472 hist << std::setw(15) << std::left <<
"snorm";
473 hist << std::setw(8) << std::left <<
"#fval";
474 hist << std::setw(8) << std::left <<
"#grad";
476 hist << std::setw(8) << std::left <<
"#cval";
486 std::stringstream hist;
487 hist <<
"\n" <<
"Primal Interior Point Solver\n";
494 std::stringstream hist;
495 hist << std::scientific << std::setprecision(6);
496 if ( algo_state.
iter == 0 ) {
502 if ( algo_state.
iter == 0 ) {
504 hist << std::setw(9) << std::left << algo_state.
iter;
506 hist << std::setw(15) << std::left <<
mu_;
507 hist << std::setw(15) << std::left << algo_state.
value;
509 hist << std::setw(15) << std::left << algo_state.
cnorm;
511 hist << std::setw(15) << std::left << algo_state.
gnorm;
516 hist << std::setw(9) << std::left << algo_state.
iter;
518 hist << std::setw(15) << std::left <<
mu_;
519 hist << std::setw(15) << std::left << algo_state.
value;
521 hist << std::setw(15) << std::left << algo_state.
cnorm;
523 hist << std::setw(15) << std::left << algo_state.
gnorm;
524 hist << std::setw(15) << std::left << algo_state.
snorm;
526 hist << std::setw(8) << std::left << algo_state.
nfval;
527 hist << std::setw(8) << std::left << algo_state.
ngrad;
529 hist << std::setw(8) << std::left << algo_state.
ncval;
540 #endif // ROL_INTERIORPOINTSTEP_H