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);
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
Provides the interface to evaluate objective functions.
EStep StringToEStep(std::string s)
virtual void projectInterior(Vector< Real > &x)
Project optimization variables into the interior of the feasible set.
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Constraint_Partitioned< Real > IPCON
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 constraints).
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.
virtual void plus(const Vector &x)=0
Compute , where .
InteriorPoint::PenalizedObjective< Real > IPOBJ
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
ROL::Ptr< Vector< Real > > c_
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Provides the interface to compute optimization steps.
ROL::Ptr< Step< Real > > step_
ROL::ParameterList parlist_
Contains definitions of custom data types in ROL.
void compute(Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Compute step.
Defines the linear algebra or vector space interface.
virtual void value(Vector< Real > &c, const Vector< Real > &x, Real &tol)=0
Evaluate the constraint operator at .
ROL::Ptr< Vector< Real > > g_
State for algorithm class. Will be used for restarts.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
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.
ROL::Ptr< Algorithm< Real > > algo_
ROL::Ptr< StepState< Real > > getState(void)
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 constraints).
Has both inequality and equality constraints. Treat inequality constraint as equality with slack vari...
void initialize(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Initialize step with no equality constraint.
ROL::Ptr< Vector< Real > > iterateVec
ROL::Ptr< Vector< Real > > x_
InteriorPointStep(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 constraints).
void updatePenalty(Real mu)
std::string print(AlgorithmState< Real > &algo_state, bool pHeader=false) const
Print iterate status.
Provides the interface to apply upper and lower bound constraints.
void update(Vector< Real > &x, const Vector< Real > &s, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Update step, if successful.
std::string printName(void) const
Print step name.
std::string printHeader(void) const
Print iterate header.
ROL::Ptr< StatusTest< Real > > 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 constraints).
ROL::Ptr< Vector< Real > > l_
virtual void set(const Vector &x)
Set where .
virtual Real norm() const =0
Returns where .
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
ROL::Ptr< BoundConstraint< Real > > bnd_
EStep
Enumeration of step types.
Defines the general constraint operator interface.
virtual void project(Vector< Real > &x)
Project optimization variables onto the bounds.