44 #ifndef ROL_INTERIORPOINTSTEP_H 45 #define ROL_INTERIORPOINTSTEP_H 71 Teuchos::RCP<Step<Real> >
step_;
74 Teuchos::RCP<Algorithm<Real> >
algo_;
79 Teuchos::RCP<Vector<Real> >
g_;
80 Teuchos::RCP<Vector<Real> >
l_;
81 Teuchos::RCP<Vector<Real> >
c_;
108 step_(Teuchos::null),
111 algo_(Teuchos::null),
117 using Teuchos::ParameterList;
119 verbosity_ = parlist.sublist(
"General").get(
"Print Verbosity",0);
122 ParameterList& iplist = parlist.sublist(
"Step").sublist(
"Interior Point");
124 mu_ = iplist.get(
"Initial Barrier Penalty",1.0);
125 mumin_ = iplist.get(
"Minimum Barrier Penalty",1.e-4);
126 mumax_ = iplist.get(
"Maximum Barrier Penalty",1e8);
127 rho_ = iplist.get(
"Barrier Penalty Reduction Factor",0.5);
132 ParameterList& stlist = parlist.sublist(
"Status Test");
134 gtol_ = stlist.get(
"Gradient Tolerance", 1.e-8);
135 ctol_ = stlist.get(
"Constraint Tolerance", 1.e-8);
136 stol_ = stlist.get(
"Step Tolerance", 1.e-8);
137 maxit_ = stlist.get(
"Iteration Limit", 100);
139 parlist_ = Teuchos::rcp(&parlist,
false);
151 state->descentVec = x.
clone();
152 state->gradientVec = g.
clone();
153 state->constraintVec = c.
clone();
156 x_ = Teuchos::rcp_static_cast<
PV>(x.
clone());
163 ipobj_ = Teuchos::rcp(&Teuchos::dyn_cast<IPOBJ>(obj),
false);
164 ipcon_ = Teuchos::rcp(&Teuchos::dyn_cast<IPCON>(con),
false);
169 algo_state.
nfval = 0;
170 algo_state.
ncval = 0;
171 algo_state.
ngrad = 0;
183 algo_state.
nfval +=
ipobj_->getNumberFunctionEvaluations();
184 algo_state.
ngrad +=
ipobj_->getNumberGradientEvaluations();
185 algo_state.
ncval +=
ipcon_->getNumberConstraintEvaluations();
225 compute(s,x,l,obj,con,algo_state);
247 state->descentVec->set(s);
257 state->constraintVec->set(*
c_);
260 state->gradientVec->set(*
g_);
262 ipcon_->applyAdjointJacobian(*
g_,*
l_,x,zerotol);
263 state->gradientVec->plus(*
g_);
266 x_->axpy(-1.0,state->gradientVec->dual());
268 Elementwise::ThresholdUpper<Real> threshold(0.0);
272 Teuchos::RCP<Vector<Real> > slack =
x_->get(
SLACK);
274 slack->applyUnary(threshold);
279 algo_state.
cnorm = state->constraintVec->norm();
282 algo_state.
nfval +=
ipobj_->getNumberFunctionEvaluations();
283 algo_state.
ngrad +=
ipobj_->getNumberGradientEvaluations();
284 algo_state.
ncval +=
ipcon_->getNumberConstraintEvaluations();
292 update(x,l,s,obj,con,algo_state);
314 std::stringstream hist;
318 hist << std::string(116,
'-') <<
"\n";
319 hist <<
"Interior Point status output definitions\n\n";
321 hist <<
" IPiter - Number of interior point steps taken\n";
322 hist <<
" CSiter - Number of Composite Steps taken in each subproblem\n";
323 hist <<
" penalty - Penalty parameter multiplying the barrier objective\n";
324 hist <<
" fval - Number of objective evaluations\n";
325 hist <<
" cnorm - Norm of the composite constraint\n";
326 hist <<
" gLnorm - Norm of the Lagrangian's gradient\n";
327 hist <<
" snorm - Norm of step (update to optimzation and slack vector)\n";
328 hist <<
" #fval - Number of objective function evaluations\n";
329 hist <<
" #grad - Number of gradient evaluations\n";
330 hist <<
" #cval - Number of composite constraint evaluations\n";
331 hist << std::string(116,
'-') <<
"\n";
337 hist << std::setw(9) << std::left <<
"IPiter";
338 hist << std::setw(9) << std::left <<
"CSiter";
339 hist << std::setw(15) << std::left <<
"penalty";
340 hist << std::setw(15) << std::left <<
"fval";
341 hist << std::setw(15) << std::left <<
"cnorm";
342 hist << std::setw(15) << std::left <<
"gLnorm";
343 hist << std::setw(15) << std::left <<
"snorm";
344 hist << std::setw(8) << std::left <<
"#fval";
345 hist << std::setw(8) << std::left <<
"#grad";
346 hist << std::setw(8) << std::left <<
"#cval";
355 std::stringstream hist;
356 hist <<
"\n" <<
"Composite Step Interior Point Solver\n";
363 std::stringstream hist;
364 hist << std::scientific << std::setprecision(6);
365 if ( algo_state.
iter == 0 ) {
371 if ( algo_state.
iter == 0 ) {
373 hist << std::setw(9) << std::left << algo_state.
iter;
375 hist << std::setw(15) << std::left <<
mu_;
376 hist << std::setw(15) << std::left << algo_state.
value;
377 hist << std::setw(15) << std::left << algo_state.
cnorm;
378 hist << std::setw(15) << std::left << algo_state.
gnorm;
383 hist << std::setw(9) << std::left << algo_state.
iter;
385 hist << std::setw(15) << std::left <<
mu_;
386 hist << std::setw(15) << std::left << algo_state.
value;
387 hist << std::setw(15) << std::left << algo_state.
cnorm;
388 hist << std::setw(15) << std::left << algo_state.
gnorm;
389 hist << std::setw(15) << std::left << algo_state.
snorm;
391 hist << std::setw(8) << std::left << algo_state.
nfval;
392 hist << std::setw(8) << std::left << algo_state.
ngrad;
393 hist << std::setw(8) << std::left << algo_state.
ncval;
408 #endif // ROL_INTERIORPOINTSTEP_H
Provides the interface to evaluate objective functions.
std::string printName(void) const
Print step name.
Teuchos::RCP< Teuchos::ParameterList > parlist_
virtual void plus(const Vector &x)=0
Compute , where .
InteriorPoint::PenalizedObjective< Real > IPOBJ
void initialize(Vector< Real > &x, const Vector< Real > &g, Vector< Real > &l, const Vector< Real > &c, Objective< Real > &obj, EqualityConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Initialize step with equality constraint.
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
InteriorPoint::CompositeConstraint< Real > IPCON
std::string print(AlgorithmState< Real > &algo_state, bool pHeader=false) const
Print iterate status.
static const size_type SLACK
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Provides the interface to compute optimization steps.
Defines the linear algebra of vector space on a generic partitioned vector.
Has both inequality and equality constraints. Treat inequality constraint as equality with slack vari...
Teuchos::RCP< StepState< Real > > getState(void)
Contains definitions of custom data types in ROL.
Teuchos::RCP< Step< Real > > step_
Teuchos::RCP< IPOBJ > ipobj_
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Defines the linear algebra or vector space interface.
virtual 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, does nothing, needs refactoring.
void initialize(Vector< Real > &x, const Vector< Real > &g, Vector< Real > &l, const Vector< Real > &c, Objective< Real > &obj, EqualityConstraint< Real > &con, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Initialize step with equality constraint.
State for algorithm class. Will be used for restarts.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
void compute(Vector< Real > &s, const Vector< Real > &x, const Vector< Real > &l, Objective< Real > &obj, EqualityConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Compute step (equality constraints).
Defines the equality constraint operator interface.
Teuchos::RCP< Vector< Real > > g_
PartitionedVector< Real > PV
Provides an interface to run optimization algorithms.
virtual 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, does nothing, needs refactoring.
Provides the interface to apply upper and lower bound constraints.
Teuchos::RCP< Algorithm< Real > > algo_
Teuchos::RCP< Vector< Real > > c_
void update(Vector< Real > &x, Vector< Real > &l, const Vector< Real > &s, Objective< Real > &obj, EqualityConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Update step, if successful (equality constraints).
std::vector< PV >::size_type size_type
static const size_type OPT
virtual void compute(Vector< Real > &s, const Vector< Real > &x, const Vector< Real > &l, Objective< Real > &obj, EqualityConstraint< Real > &con, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Compute step (equality constraints).
Teuchos::RCP< Vector< Real > > iterateVec
virtual void set(const Vector &x)
Set where .
virtual Real norm() const =0
Returns where .
void update(Vector< Real > &x, Vector< Real > &l, const Vector< Real > &s, Objective< Real > &obj, EqualityConstraint< Real > &con, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Update step, if successful (equality constraints).
Teuchos::RCP< Vector< Real > > l_
virtual void value(Vector< Real > &c, const Vector< Real > &x, Real &tol)=0
Evaluate the constraint operator at .
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
Teuchos::RCP< IPCON > ipcon_
std::string printHeader(void) const
Print iterate header.
Teuchos::RCP< StatusTest< Real > > status_
InteriorPointStep(Teuchos::ParameterList &parlist)