44 #ifndef ROL_INTERIORPOINTSTEP_H 45 #define ROL_INTERIORPOINTSTEP_H 65 const static size_type
OPT = 0;
66 const static size_type
SLACK = 1;
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_;
100 status_(Teuchos::null),
101 step_(Teuchos::null),
102 ipobj_(Teuchos::null),
103 ipcon_(Teuchos::null),
104 algo_(Teuchos::null),
110 using Teuchos::ParameterList;
113 ParameterList& iplist = parlist.sublist(
"Step").sublist(
"Interior Point");
115 mu_ = iplist.get(
"Initial Barrier Penalty",1.0);
116 eps_ = iplist.get(
"Minimum Barrier Penalty",1.e-4);
117 rho_ = iplist.get(
"Barrier Penalty Reduction Factor",0.5);
118 subproblemIter_ = iplist.get(
"Subproblem Iteration Limit",10);
122 ParameterList& stlist = parlist.sublist(
"Status Test");
124 gtol_ = stlist.get(
"Gradient Tolerance", 1.e-8);
125 ctol_ = stlist.get(
"Constraint Tolerance", 1.e-8);
126 stol_ = stlist.get(
"Step Tolerance", 1.e-8);
127 maxit_ = stlist.get(
"Iteration Limit", 100);
129 parlist_ = Teuchos::rcp(&parlist,
false);
141 state->descentVec = x.
clone();
142 state->gradientVec = g.
clone();
143 state->constraintVec = c.
clone();
146 x_ = Teuchos::rcp_static_cast<PV>(x.
clone());
153 ipobj_ = Teuchos::rcp(&Teuchos::dyn_cast<IPOBJ>(obj),
false);
154 ipcon_ = Teuchos::rcp(&Teuchos::dyn_cast<IPCON>(con),
false);
157 ipobj_->updatePenalty(mu_);
159 algo_state.
nfval = 0;
160 algo_state.
ncval = 0;
161 algo_state.
ngrad = 0;
168 algo_state.
gnorm = g_->norm();
170 con.
value(*c_,*x_,zerotol);
171 algo_state.
cnorm = c_->norm();
173 algo_state.
nfval += ipobj_->getNumberFunctionEvaluations();
174 algo_state.
ngrad += ipobj_->getNumberGradientEvaluations();
175 algo_state.
ncval += ipcon_->getNumberConstraintEvaluations();
197 algo_ = Teuchos::rcp(
new Algorithm<Real>(
"Composite Step",*parlist_,
false) );
202 algo_->run(*x_,*g_,*l_,*c_,*ipobj_,*ipcon_,
false);
207 subproblemIter_ = (algo_->getState())->iter;
215 compute(s,x,l,obj,con,algo_state);
228 ipobj_->updatePenalty(mu_);
237 state->descentVec->set(s);
243 algo_state.
value = ipobj_->value(x,zerotol);
244 algo_state.
value = ipobj_->getObjectiveValue();
246 ipcon_->value(*c_,x,zerotol);
247 state->constraintVec->set(*c_);
249 ipobj_->gradient(*g_,x,zerotol);
250 state->gradientVec->set(*g_);
252 ipcon_->applyAdjointJacobian(*g_,*l_,x,zerotol);
253 state->gradientVec->plus(*g_);
256 x_->axpy(-1.0,state->gradientVec->dual());
258 Elementwise::ThresholdUpper<Real> threshold(0.0);
262 Teuchos::RCP<Vector<Real> > slack = x_->get(SLACK);
264 slack->applyUnary(threshold);
268 algo_state.
gnorm = x_->norm();
269 algo_state.
cnorm = state->constraintVec->norm();
272 algo_state.
nfval += ipobj_->getNumberFunctionEvaluations();
273 algo_state.
ngrad += ipobj_->getNumberGradientEvaluations();
274 algo_state.
ncval += ipcon_->getNumberConstraintEvaluations();
282 update(x,l,s,obj,con,algo_state);
304 std::stringstream hist;
306 hist << std::setw(9) << std::left <<
"IPiter";
307 hist << std::setw(9) << std::left <<
"CSiter";
308 hist << std::setw(15) << std::left <<
"penalty";
309 hist << std::setw(15) << std::left <<
"fval";
310 hist << std::setw(15) << std::left <<
"cnorm";
311 hist << std::setw(15) << std::left <<
"gLnorm";
312 hist << std::setw(15) << std::left <<
"snorm";
313 hist << std::setw(8) << std::left <<
"#fval";
314 hist << std::setw(8) << std::left <<
"#grad";
315 hist << std::setw(8) << std::left <<
"#cval";
324 std::stringstream hist;
325 hist <<
"\n" <<
"Composite Step Interior Point Solver\n";
332 std::stringstream hist;
333 hist << std::scientific << std::setprecision(6);
334 if ( algo_state.
iter == 0 ) {
340 if ( algo_state.
iter == 0 ) {
342 hist << std::setw(9) << std::left << algo_state.
iter;
344 hist << std::setw(15) << std::left <<
mu_;
345 hist << std::setw(15) << std::left << algo_state.
value;
346 hist << std::setw(15) << std::left << algo_state.
cnorm;
347 hist << std::setw(15) << std::left << algo_state.
gnorm;
352 hist << std::setw(9) << std::left << algo_state.
iter;
354 hist << std::setw(15) << std::left <<
mu_;
355 hist << std::setw(15) << std::left << algo_state.
value;
356 hist << std::setw(15) << std::left << algo_state.
cnorm;
357 hist << std::setw(15) << std::left << algo_state.
gnorm;
358 hist << std::setw(15) << std::left << algo_state.
snorm;
360 hist << std::setw(8) << std::left << algo_state.
nfval;
361 hist << std::setw(8) << std::left << algo_state.
ngrad;
362 hist << std::setw(8) << std::left << algo_state.
ncval;
377 #endif // ROL_INTERIORPOINTSTEP_H
Provides the interface to evaluate objective functions.
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
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.
std::string print(AlgorithmState< Real > &algo_state, bool pHeader=false) const
Print iterate status.
Provides the interface to apply upper and lower bound constraints.
std::string printName(void) const
Print step name.
Teuchos::RCP< Algorithm< Real > > algo_
std::string printHeader(void) const
Print iterate header.
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_
Teuchos::RCP< StatusTest< Real > > status_
InteriorPointStep(Teuchos::ParameterList &parlist)