44 #ifndef ROL_INTERIORPOINTSTEP_H
45 #define ROL_INTERIORPOINTSTEP_H
64 class AugmentedLagrangianStep;
67 class InteriorPointStep :
public Step<Real> {
76 ROL::Ptr<Algorithm<Real> >
algo_;
77 ROL::Ptr<BoundConstraint<Real> >
bnd_;
81 ROL::Ptr<Vector<Real> >
x_;
82 ROL::Ptr<Vector<Real> >
g_;
83 ROL::Ptr<Vector<Real> >
l_;
84 ROL::Ptr<Vector<Real> >
c_;
124 using ROL::ParameterList;
126 verbosity_ = parlist.sublist(
"General").get(
"Print Verbosity",0);
129 ParameterList& iplist = parlist.sublist(
"Step").sublist(
"Interior Point");
130 mu_ = iplist.get(
"Initial Barrier Penalty",1.0);
131 mumin_ = iplist.get(
"Minimum Barrier Penalty",1.e-4);
132 mumax_ = iplist.get(
"Maximum Barrier Penalty",1e8);
133 rho_ = iplist.get(
"Barrier Penalty Reduction Factor",0.5);
136 print_ = iplist.sublist(
"Subproblem").get(
"Print History",
false);
137 Real gtol = iplist.sublist(
"Subproblem").get(
"Optimality Tolerance",1e-8);
138 Real ctol = iplist.sublist(
"Subproblem").get(
"Feasibility Tolerance",1e-8);
139 Real stol =
static_cast<Real
>(1e-6)*std::min(gtol,ctol);
140 int maxit = iplist.sublist(
"Subproblem").get(
"Iteration Limit",1000);
141 parlist_.sublist(
"Status Test").set(
"Gradient Tolerance", gtol);
142 parlist_.sublist(
"Status Test").set(
"Constraint Tolerance", ctol);
143 parlist_.sublist(
"Status Test").set(
"Step Tolerance", stol);
144 parlist_.sublist(
"Status Test").set(
"Iteration Limit", maxit);
146 stepname_ = iplist.sublist(
"Subproblem").get(
"Step Type",
"Composite Step");
159 state->descentVec = x.
clone();
160 state->gradientVec = g.
clone();
161 state->constraintVec = c.
clone();
171 auto& ipobj =
dynamic_cast<IPOBJ&
>(obj);
172 auto& ipcon =
dynamic_cast<IPCON&
>(con);
175 ipobj.updatePenalty(
mu_);
177 algo_state.
nfval = 0;
178 algo_state.
ncval = 0;
179 algo_state.
ngrad = 0;
191 algo_state.
nfval += ipobj.getNumberFunctionEvaluations();
192 algo_state.
ngrad += ipobj.getNumberGradientEvaluations();
193 algo_state.
ncval += ipcon.getNumberConstraintEvaluations();
215 state->descentVec = x.
clone();
216 state->gradientVec = g.
clone();
223 auto& ipobj =
dynamic_cast<IPOBJ&
>(obj);
226 algo_state.
nfval = 0;
227 algo_state.
ncval = 0;
228 algo_state.
ngrad = 0;
230 Real zerotol = std::sqrt(ROL_EPSILON<Real>());
237 algo_state.
cnorm =
static_cast<Real
>(0);
239 algo_state.
nfval += ipobj.getNumberFunctionEvaluations();
240 algo_state.
ngrad += ipobj.getNumberGradientEvaluations();
242 bnd_ = ROL::makePtr<BoundConstraint<Real>>();
262 Ptr<Objective<Real>> penObj;
264 Ptr<Objective<Real>> raw_obj = makePtrFromRef(obj);
265 Ptr<Constraint<Real>> raw_con = makePtrFromRef(con);
267 penObj = makePtr<AugmentedLagrangian<Real>>(raw_obj,raw_con,l,one,x,*(state->constraintVec),
parlist_);
271 Ptr<Objective<Real>> raw_obj = makePtrFromRef(obj);
272 Ptr<Constraint<Real>> raw_con = makePtrFromRef(con);
274 penObj = makePtr<Fletcher<Real>>(raw_obj,raw_con,x,*(state->constraintVec),
parlist_);
278 penObj = makePtrFromRef(obj);
287 x_->set(x);
l_->set(l);
302 compute(s,x,l,obj,con,algo_state);
312 auto& ipobj =
dynamic_cast<IPOBJ&
>(obj);
332 s.
set(*
x_); s.
axpy(static_cast<Real>(-1),x);
349 auto& ipobj =
dynamic_cast<IPOBJ&
>(obj);
350 auto& ipcon =
dynamic_cast<IPCON&
>(con);
355 ipobj.updatePenalty(
mu_);
365 state->descentVec->set(s);
371 algo_state.
value = ipobj.value(x,zerotol);
372 algo_state.
value = ipobj.getObjectiveValue();
374 ipcon.value(*
c_,x,zerotol);
375 state->constraintVec->set(*
c_);
377 ipobj.gradient(*
g_,x,zerotol);
378 state->gradientVec->set(*
g_);
380 ipcon.applyAdjointJacobian(*
g_,*
l_,x,zerotol);
381 state->gradientVec->plus(*
g_);
384 algo_state.
cnorm = state->constraintVec->norm();
387 algo_state.
nfval += ipobj.getNumberFunctionEvaluations();
388 algo_state.
ngrad += ipobj.getNumberGradientEvaluations();
389 algo_state.
ncval += ipcon.getNumberConstraintEvaluations();
400 update(x,l,s,obj,con,algo_state);
404 x_->axpy(static_cast<Real>(-1),state->gradientVec->dual());
406 x_->axpy(static_cast<Real>(-1),x);
416 auto& ipobj =
dynamic_cast<IPOBJ&
>(obj);
421 ipobj.updatePenalty(
mu_);
430 state->descentVec->set(s);
434 Real zerotol = std::sqrt(ROL_EPSILON<Real>());
436 algo_state.
value = ipobj.value(x,zerotol);
437 algo_state.
value = ipobj.getObjectiveValue();
439 ipobj.gradient(*
g_,x,zerotol);
440 state->gradientVec->set(*
g_);
443 x_->axpy(static_cast<Real>(-1),state->gradientVec->dual());
445 x_->axpy(static_cast<Real>(-1),x);
450 algo_state.
nfval += ipobj.getNumberFunctionEvaluations();
451 algo_state.
ngrad += ipobj.getNumberGradientEvaluations();
457 std::stringstream hist;
461 hist << std::string(116,
'-') <<
"\n";
462 hist <<
"Interior Point status output definitions\n\n";
464 hist <<
" IPiter - Number of interior point steps taken\n";
465 hist <<
" SPiter - Number of subproblem solver iterations\n";
466 hist <<
" penalty - Penalty parameter multiplying the barrier objective\n";
467 hist <<
" fval - Number of objective evaluations\n";
469 hist <<
" cnorm - Norm of the composite constraint\n";
470 hist <<
" gLnorm - Norm of the Lagrangian's gradient\n";
473 hist <<
" gnorm - Norm of the projected norm of the objective gradient\n";
475 hist <<
" snorm - Norm of step (update to optimzation and slack vector)\n";
476 hist <<
" #fval - Number of objective function evaluations\n";
477 hist <<
" #grad - Number of gradient evaluations\n";
479 hist <<
" #cval - Number of composite constraint evaluations\n";
481 hist << std::string(116,
'-') <<
"\n";
485 hist << std::setw(9) << std::left <<
"IPiter";
486 hist << std::setw(9) << std::left <<
"SPiter";
487 hist << std::setw(15) << std::left <<
"penalty";
488 hist << std::setw(15) << std::left <<
"fval";
490 hist << std::setw(15) << std::left <<
"cnorm";
491 hist << std::setw(15) << std::left <<
"gLnorm";
494 hist << std::setw(15) << std::left <<
"gnorm";
496 hist << std::setw(15) << std::left <<
"snorm";
497 hist << std::setw(8) << std::left <<
"#fval";
498 hist << std::setw(8) << std::left <<
"#grad";
500 hist << std::setw(8) << std::left <<
"#cval";
510 std::stringstream hist;
511 hist <<
"\n" <<
"Primal Interior Point Solver\n";
518 std::stringstream hist;
519 hist << std::scientific << std::setprecision(6);
520 if ( algo_state.
iter == 0 ) {
526 if ( algo_state.
iter == 0 ) {
528 hist << std::setw(9) << std::left << algo_state.
iter;
530 hist << std::setw(15) << std::left <<
mu_;
531 hist << std::setw(15) << std::left << algo_state.
value;
533 hist << std::setw(15) << std::left << algo_state.
cnorm;
535 hist << std::setw(15) << std::left << algo_state.
gnorm;
540 hist << std::setw(9) << std::left << algo_state.
iter;
542 hist << std::setw(15) << std::left <<
mu_;
543 hist << std::setw(15) << std::left << algo_state.
value;
545 hist << std::setw(15) << std::left << algo_state.
cnorm;
547 hist << std::setw(15) << std::left << algo_state.
gnorm;
548 hist << std::setw(15) << std::left << algo_state.
snorm;
550 hist << std::setw(8) << std::left << algo_state.
nfval;
551 hist << std::setw(8) << std::left << algo_state.
ngrad;
553 hist << std::setw(8) << std::left << algo_state.
ncval;
564 #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.