44 #ifndef ROL_PRIMALDUALACTIVESETSTEP_H
45 #define ROL_PRIMALDUALACTIVESETSTEP_H
56 #include "Teuchos_ParameterList.hpp"
134 template <
class Real>
139 Teuchos::RCP<PrimalDualPreconditioner<Real> >
precond_;
160 Teuchos::RCP<Vector<Real> >
x0_;
162 Teuchos::RCP<Vector<Real> >
As_;
164 Teuchos::RCP<Vector<Real> >
res_;
165 Teuchos::RCP<Vector<Real> >
Ag_;
189 obj.
gradient(*(step_state->gradientVec),x,tol);
191 xtmp_->axpy(-1.0,(step_state->gradientVec)->dual());
194 return xtmp_->norm();
199 Real absTol = parlist.get(
"Absolute Krylov Tolerance", 1.e-4);
200 Real relTol = parlist.get(
"Relative Krylov Tolerance", 1.e-2);
201 int maxit = parlist.get(
"Maximum Number of Krylov Iterations", 20);
202 bool inexact = parlist.get(
"Use Inexact Hessian-Times-A-Vector",
false);
222 maxit_ = parlist.get(
"PDAS Maximum Number of Iterations",10);
223 stol_ = parlist.get(
"PDAS Relative Step Tolerance",1.e-8);
224 gtol_ = parlist.get(
"PDAS Relative Gradient Tolerance",1.e-6);
225 scale_ = parlist.get(
"PDAS Dual Scaling", 1.0);
231 int L = parlist.get(
"Maximum Secant Storage",10);
232 int BB = parlist.get(
"Barzilai-Borwein",1);
254 step_state->descentVec = s.
clone();
255 step_state->gradientVec = g.
clone();
256 step_state->searchSize = 0.0;
278 lambda_->set((step_state->gradientVec)->dual());
282 Teuchos::RCP<Objective<Real> > obj_ptr = Teuchos::rcp(&obj,
false);
283 Teuchos::RCP<BoundConstraint<Real> > con_ptr = Teuchos::rcp(&con,
false);
321 res_->set(*(step_state->gradientVec));
360 rtmp_->set(*(step_state->gradientVec));
363 Ag_->set(*(step_state->gradientVec));
371 if (
rtmp_->norm() > 0.0 ) {
397 res_->set(*(step_state->gradientVec));
419 if (
iter_ == maxit_ ) {
451 if (
secant_ != Teuchos::null ) {
452 gtmp_->set(*(step_state->gradientVec));
457 if (
secant_ != Teuchos::null ) {
469 std::stringstream hist;
471 hist << std::setw(6) << std::left <<
"iter";
472 hist << std::setw(15) << std::left <<
"value";
473 hist << std::setw(15) << std::left <<
"gnorm";
474 hist << std::setw(15) << std::left <<
"snorm";
475 hist << std::setw(10) << std::left <<
"#fval";
476 hist << std::setw(10) << std::left <<
"#grad";
478 hist << std::setw(10) << std::left <<
"iterPDAS";
479 hist << std::setw(10) << std::left <<
"flagPDAS";
482 hist << std::setw(10) << std::left <<
"iterCR";
483 hist << std::setw(10) << std::left <<
"flagCR";
485 hist << std::setw(10) << std::left <<
"feasible";
496 std::stringstream hist;
497 hist <<
"\nPrimal Dual Active Set Newton's Method\n";
509 std::stringstream hist;
510 hist << std::scientific << std::setprecision(6);
511 if ( algo_state.
iter == 0 ) {
514 if ( print_header ) {
517 if ( algo_state.
iter == 0 ) {
519 hist << std::setw(6) << std::left << algo_state.
iter;
520 hist << std::setw(15) << std::left << algo_state.
value;
521 hist << std::setw(15) << std::left << algo_state.
gnorm;
526 hist << std::setw(6) << std::left << algo_state.
iter;
527 hist << std::setw(15) << std::left << algo_state.
value;
528 hist << std::setw(15) << std::left << algo_state.
gnorm;
529 hist << std::setw(15) << std::left << algo_state.
snorm;
530 hist << std::setw(10) << std::left << algo_state.
nfval;
531 hist << std::setw(10) << std::left << algo_state.
ngrad;
533 hist << std::setw(10) << std::left <<
iter_;
534 hist << std::setw(10) << std::left <<
flag_;
537 hist << std::setw(10) << std::left <<
iterCR_;
538 hist << std::setw(10) << std::left <<
flagCR_;
541 hist << std::setw(10) << std::left <<
"YES";
544 hist << std::setw(10) << std::left <<
"NO";
Teuchos::RCP< Vector< Real > > rtmp_
Container for temporary right hand side storage.
Implements the computation of optimization steps with the Newton primal-dual active set method...
Provides the interface to evaluate objective functions.
Teuchos::RCP< Vector< Real > > As_
Container for step projected onto active set.
std::string printName(void) const
Print step name.
Provides definition of the Conjugate Residual solver.
virtual void plus(const Vector &x)=0
Compute , where .
void KrylovFactory(Teuchos::ParameterList &parlist)
std::string printHeader(void) const
Print iterate header.
int iter_
PDAS iteration counter.
int iterCR_
CR iteration counter.
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Provides the interface to compute optimization steps.
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
Teuchos::RCP< StepState< Real > > getState(void)
Contains definitions of custom data types in ROL.
Real neps_
-active set parameter
virtual void pruneLowerActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0.0)
Set variables to zero if they correspond to the lower -active set.
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Teuchos::RCP< Krylov< Real > > krylov_
ESecant StringToESecant(std::string s)
virtual void setVectorToUpperBound(Vector< Real > &u)
Set the input vector to the upper bound.
Teuchos::RCP< Vector< Real > > gtmp_
Container for temporary gradient storage.
Teuchos::RCP< 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.
Teuchos::RCP< Vector< Real > > x0_
Container for initial priaml variables.
EKrylov
Enumeration of Krylov methods.
Teuchos::RCP< Vector< Real > > lambda_
Container for dual variables.
int flagCR_
CR termination flag.
EKrylov StringToEKrylov(std::string s)
int flag_
PDAS termination flag.
State for algorithm class. Will be used for restarts.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
ESecant
Enumeration of secant update algorithms.
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.
virtual void pruneUpperActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0.0)
Set variables to zero if they correspond to the upper -active set.
Teuchos::RCP< PrimalDualHessian< Real > > hessian_
bool feasible_
Flag whether the current iterate is feasible or not.
Real computeCriticalityMeasure(Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &con, Real tol)
Compute the gradient-based criticality measure.
Teuchos::RCP< Vector< Real > > xbnd_
Container for primal variable bounds.
Teuchos::RCP< Vector< Real > > xlam_
Container for primal plus dual variables.
Provides definitions of the Conjugate Gradient solver.
virtual void setVectorToLowerBound(Vector< Real > &l)
Set the input vector to the lower bound.
Provides the interface to apply upper and lower bound constraints.
Teuchos::RCP< PrimalDualPreconditioner< Real > > precond_
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.
PrimalDualActiveSetStep(Teuchos::ParameterList &parlist)
Constructor.
Teuchos::RCP< Vector< Real > > xtmp_
Container for temporary primal storage.
Real stol_
PDAS minimum step size stopping tolerance.
Teuchos::RCP< Vector< Real > > iterateVec
virtual void pruneActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0.0)
Set variables to zero if they correspond to the -active set.
virtual Real norm() const =0
Returns where .
Real itol_
Inexact CR tolerance.
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
ESecant esec_
Enum for secant type.
virtual bool isFeasible(const Vector< Real > &v)
Check if the vector, v, is feasible.
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.
Teuchos::RCP< Vector< Real > > res_
Container for optimality system residual for quadratic model.
virtual void project(Vector< Real > &x)
Project optimization variables onto the bounds.
int maxit_
Maximum number of PDAS iterations.
static const double ROL_EPSILON
Platform-dependent machine epsilon.
Teuchos::RCP< Vector< Real > > Ag_
Container for gradient projected onto active set.