9 #ifndef ROL_PRIMALDUALACTIVESETSTEP_H
10 #define ROL_PRIMALDUALACTIVESETSTEP_H
19 #include "ROL_ParameterList.hpp"
121 ROL::Ptr<Vector<Real> >
x0_;
123 ROL::Ptr<Vector<Real> >
As_;
126 ROL::Ptr<Vector<Real> >
Ag_;
138 const ROL::Ptr<Objective<Real> >
obj_;
139 const ROL::Ptr<BoundConstraint<Real> >
bnd_;
140 const ROL::Ptr<Vector<Real> >
x_;
141 const ROL::Ptr<Vector<Real> >
xlam_;
142 ROL::Ptr<Vector<Real> >
v_;
153 const bool useSecant =
false )
157 if ( !useSecant || secant == ROL::nullPtr ) {
176 const ROL::Ptr<Objective<Real> >
obj_;
177 const ROL::Ptr<BoundConstraint<Real> >
bnd_;
178 const ROL::Ptr<Vector<Real> >
x_;
179 const ROL::Ptr<Vector<Real> >
xlam_;
180 ROL::Ptr<Vector<Real> >
v_;
191 const bool useSecant =
false )
194 v_ =
x_->dual().clone();
195 if ( !useSecant || secant == ROL::nullPtr ) {
230 obj.
gradient(*(step_state->gradientVec),x,tol);
232 xtmp_->axpy(-one,(step_state->gradientVec)->dual());
235 return xtmp_->norm();
252 res_(ROL::nullPtr),
Ag_(ROL::nullPtr),
rtmp_(ROL::nullPtr),
256 Real one(1), oem6(1.e-6), oem8(1.e-8);
258 maxit_ = parlist.sublist(
"Step").sublist(
"Primal Dual Active Set").get(
"Iteration Limit",10);
259 stol_ = parlist.sublist(
"Step").sublist(
"Primal Dual Active Set").get(
"Relative Step Tolerance",oem8);
260 gtol_ = parlist.sublist(
"Step").sublist(
"Primal Dual Active Set").get(
"Relative Gradient Tolerance",oem6);
261 scale_ = parlist.sublist(
"Step").sublist(
"Primal Dual Active Set").get(
"Dual Scaling", one);
263 std::string secantType = parlist.sublist(
"General").sublist(
"Secant").get(
"Type",
"Limited-Memory BFGS");
265 useSecantHessVec_ = parlist.sublist(
"General").sublist(
"Secant").get(
"Use as Hessian",
false);
266 useSecantPrecond_ = parlist.sublist(
"General").sublist(
"Secant").get(
"Use as Preconditioner",
false);
268 secant_ = SecantFactory<Real>(parlist);
271 krylov_ = KrylovFactory<Real>(parlist);
290 Real
zero(0), one(1);
292 step_state->descentVec = s.
clone();
293 step_state->gradientVec = g.
clone();
294 step_state->searchSize =
zero;
308 Real tol = std::sqrt(ROL_EPSILON<Real>());
316 lambda_->set((step_state->gradientVec)->dual());
349 Real
zero(0), one(1);
352 res_->set(*(step_state->gradientVec));
380 itol_ = std::sqrt(ROL_EPSILON<Real>());
391 rtmp_->set(*(step_state->gradientVec));
394 Ag_->set(*(step_state->gradientVec));
404 ROL::Ptr<Objective<Real> > obj_ptr = ROL::makePtrFromRef(obj);
405 ROL::Ptr<BoundConstraint<Real> > con_ptr = ROL::makePtrFromRef(con);
406 ROL::Ptr<LinearOperator<Real> > hessian
407 = ROL::makePtr<HessianPD>(obj_ptr,con_ptr,
409 ROL::Ptr<LinearOperator<Real> > precond
410 = ROL::makePtr<PrecondPD>(obj_ptr,con_ptr,
437 res_->set(*(step_state->gradientVec));
459 if (
iter_ == maxit_ ) {
489 Real tol = std::sqrt(ROL_EPSILON<Real>());
494 if (
secant_ != ROL::nullPtr ) {
495 gtmp_->set(*(step_state->gradientVec));
500 if (
secant_ != ROL::nullPtr ) {
512 std::stringstream hist;
514 hist << std::setw(6) << std::left <<
"iter";
515 hist << std::setw(15) << std::left <<
"value";
516 hist << std::setw(15) << std::left <<
"gnorm";
517 hist << std::setw(15) << std::left <<
"snorm";
518 hist << std::setw(10) << std::left <<
"#fval";
519 hist << std::setw(10) << std::left <<
"#grad";
521 hist << std::setw(10) << std::left <<
"iterPDAS";
522 hist << std::setw(10) << std::left <<
"flagPDAS";
525 hist << std::setw(10) << std::left <<
"iterCR";
526 hist << std::setw(10) << std::left <<
"flagCR";
528 hist << std::setw(10) << std::left <<
"feasible";
539 std::stringstream hist;
540 hist <<
"\nPrimal Dual Active Set Newton's Method\n";
552 std::stringstream hist;
553 hist << std::scientific << std::setprecision(6);
554 if ( algo_state.
iter == 0 ) {
557 if ( print_header ) {
560 if ( algo_state.
iter == 0 ) {
562 hist << std::setw(6) << std::left << algo_state.
iter;
563 hist << std::setw(15) << std::left << algo_state.
value;
564 hist << std::setw(15) << std::left << algo_state.
gnorm;
569 hist << std::setw(6) << std::left << algo_state.
iter;
570 hist << std::setw(15) << std::left << algo_state.
value;
571 hist << std::setw(15) << std::left << algo_state.
gnorm;
572 hist << std::setw(15) << std::left << algo_state.
snorm;
573 hist << std::setw(10) << std::left << algo_state.
nfval;
574 hist << std::setw(10) << std::left << algo_state.
ngrad;
576 hist << std::setw(10) << std::left <<
iter_;
577 hist << std::setw(10) << std::left <<
flag_;
580 hist << std::setw(10) << std::left <<
iterCR_;
581 hist << std::setw(10) << std::left <<
flagCR_;
584 hist << std::setw(10) << std::left <<
"YES";
587 hist << std::setw(10) << std::left <<
"NO";
virtual bool isFeasible(const Vector< Real > &v)
Check if the vector, v, is feasible.
ROL::Ptr< Vector< Real > > v_
Implements the computation of optimization steps with the Newton primal-dual active set method...
Provides the interface to evaluate objective functions.
std::string printName(void) const
Print step name.
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void plus(const Vector &x)=0
Compute , where .
std::string printHeader(void) const
Print iterate header.
int iter_
PDAS iteration counter.
virtual void pruneUpperActive(Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the upper -active set.
int iterCR_
CR iteration counter.
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Provides the interface to compute optimization steps.
const ROL::Ptr< BoundConstraint< Real > > bnd_
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
const ROL::Ptr< Vector< Real > > xlam_
Contains definitions of custom data types in ROL.
Real neps_
-active set parameter
const ROL::Ptr< Secant< Real > > secant_
HessianPD(const ROL::Ptr< Objective< Real > > &obj, const ROL::Ptr< BoundConstraint< Real > > &bnd, const ROL::Ptr< Vector< Real > > &x, const ROL::Ptr< Vector< Real > > &xlam, const Real eps=0, const ROL::Ptr< Secant< Real > > &secant=ROL::nullPtr, const bool useSecant=false)
ESecant StringToESecant(std::string s)
const ROL::Ptr< Vector< Real > > x_
ROL::Ptr< Secant< Real > > secant_
Secant object.
virtual void zero()
Set to zero vector.
Real scale_
Scale for dual variables in the active set, .
Defines the linear algebra or vector space interface.
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
ROL::Ptr< Vector< Real > > gtmp_
Container for temporary gradient storage.
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
const ROL::Ptr< Vector< Real > > xlam_
virtual const Ptr< const Vector< Real > > getLowerBound(void) const
Return the ref count pointer to the lower bound vector.
ROL::Ptr< Vector< Real > > res_
Container for optimality system residual for quadratic model.
int flagCR_
CR termination flag.
int flag_
PDAS termination flag.
State for algorithm class. Will be used for restarts.
ROL::Ptr< Vector< Real > > x0_
Container for initial priaml variables.
const ROL::Ptr< Objective< Real > > obj_
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
PrimalDualActiveSetStep(ROL::ParameterList &parlist)
Constructor.
ESecant
Enumeration of secant update algorithms.
ROL::Ptr< Vector< Real > > rtmp_
Container for temporary right hand side storage.
ROL::Ptr< Vector< Real > > Ag_
Container for gradient projected onto active set.
ROL::Ptr< StepState< Real > > getState(void)
void initialize(Vector< Real > &x, const Vector< Real > &s, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Initialize step with bound constraint.
const ROL::Ptr< BoundConstraint< Real > > bnd_
bool feasible_
Flag whether the current iterate is feasible or not.
const ROL::Ptr< Objective< Real > > obj_
virtual void pruneLowerActive(Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the lower -active set.
Provides interface for and implements limited-memory secant operators.
void apply(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply linear operator.
Real computeCriticalityMeasure(Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &con, Real tol)
Compute the gradient-based criticality measure.
ROL::Ptr< Vector< Real > > iterateVec
ROL::Ptr< Vector< Real > > xbnd_
Container for primal variable bounds.
const ROL::Ptr< Secant< Real > > secant_
virtual void project(Vector< Real > &x)
Project optimization variables onto the bounds.
virtual const Ptr< const Vector< Real > > getUpperBound(void) const
Return the ref count pointer to the upper bound vector.
void pruneActive(Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the -active set.
Provides the interface to apply a linear operator.
Provides the interface to apply upper and lower bound constraints.
void compute(Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Compute step.
Real gtol_
PDAS gradient stopping tolerance.
PrecondPD(const ROL::Ptr< Objective< Real > > &obj, const ROL::Ptr< BoundConstraint< Real > > &bnd, const ROL::Ptr< Vector< Real > > &x, const ROL::Ptr< Vector< Real > > &xlam, const Real eps=0, const ROL::Ptr< Secant< Real > > &secant=ROL::nullPtr, const bool useSecant=false)
Real stol_
PDAS minimum step size stopping tolerance.
ROL::Ptr< Vector< Real > > lambda_
Container for dual variables.
virtual void set(const Vector &x)
Set where .
virtual Real norm() const =0
Returns where .
ROL::Ptr< Krylov< Real > > krylov_
Real itol_
Inexact CR tolerance.
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.
void applyInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply inverse of linear operator.
ROL::Ptr< Vector< Real > > xlam_
Container for primal plus dual variables.
ESecant esec_
Enum for secant type.
const ROL::Ptr< Vector< Real > > x_
ROL::Ptr< Vector< Real > > v_
void update(Vector< Real > &x, const Vector< Real > &s, Objective< Real > &obj, BoundConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Update step, if successful.
virtual std::string print(AlgorithmState< Real > &algo_state, bool print_header=false) const
Print iterate status.
ROL::Ptr< Vector< Real > > As_
Container for step projected onto active set.
ROL::Ptr< Vector< Real > > xtmp_
Container for temporary primal storage.
void apply(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply linear operator.
int maxit_
Maximum number of PDAS iterations.