10 #ifndef ROL_PROJECTEDNEWTONSTEP_H
11 #define ROL_PROJECTEDNEWTONSTEP_H
28 ROL::Ptr<Vector<Real> >
gp_;
29 ROL::Ptr<Vector<Real> >
d_;
48 :
Step<Real>(),
gp_(ROL::nullPtr),
d_(ROL::nullPtr),
51 ROL::ParameterList& Glist = parlist.sublist(
"General");
53 verbosity_ = parlist.sublist(
"General").get(
"Print Verbosity",0);
67 Real tol = std::sqrt(ROL_EPSILON<Real>()), one(1);
72 gp_->set(*(step_state->gradientVec));
77 gp_->set(*(step_state->gradientVec));
86 Real tol = std::sqrt(ROL_EPSILON<Real>()), one(1);
94 (step_state->descentVec)->set(x);
95 (step_state->descentVec)->axpy(-one,*
d_);
104 obj.
gradient(*(step_state->gradientVec),x,tol);
110 gp_->set(*(step_state->gradientVec));
116 d_->axpy(-one,(step_state->gradientVec)->dual());
124 std::stringstream hist;
127 hist << std::string(109,
'-') <<
"\n";
129 hist <<
" status output definitions\n\n";
130 hist <<
" iter - Number of iterates (steps taken) \n";
131 hist <<
" value - Objective function value \n";
132 hist <<
" gnorm - Norm of the gradient\n";
133 hist <<
" snorm - Norm of the step (update to optimization vector)\n";
134 hist <<
" #fval - Cumulative number of times the objective function was evaluated\n";
135 hist <<
" #grad - Number of times the gradient was computed\n";
136 hist << std::string(109,
'-') <<
"\n";
140 hist << std::setw(6) << std::left <<
"iter";
141 hist << std::setw(15) << std::left <<
"value";
142 hist << std::setw(15) << std::left <<
"gnorm";
143 hist << std::setw(15) << std::left <<
"snorm";
144 hist << std::setw(10) << std::left <<
"#fval";
145 hist << std::setw(10) << std::left <<
"#grad";
150 std::stringstream hist;
155 std::stringstream hist;
156 hist << std::scientific << std::setprecision(6);
157 if ( algo_state.
iter == 0 ) {
160 if ( print_header ) {
163 if ( algo_state.
iter == 0 ) {
165 hist << std::setw(6) << std::left << algo_state.
iter;
166 hist << std::setw(15) << std::left << algo_state.
value;
167 hist << std::setw(15) << std::left << algo_state.
gnorm;
172 hist << std::setw(6) << std::left << algo_state.
iter;
173 hist << std::setw(15) << std::left << algo_state.
value;
174 hist << std::setw(15) << std::left << algo_state.
gnorm;
175 hist << std::setw(15) << std::left << algo_state.
snorm;
176 hist << std::setw(10) << std::left << algo_state.
nfval;
177 hist << std::setw(10) << std::left << algo_state.
ngrad;
Provides the interface to evaluate objective functions.
virtual void scale(const Real alpha)=0
Compute where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void plus(const Vector &x)=0
Compute , where .
ROL::Ptr< Vector< Real > > gp_
Additional vector storage.
Provides the interface to compute optimization steps with projected Newton's method using line search...
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Provides the interface to compute optimization steps.
Contains definitions of custom data types in ROL.
int verbosity_
Verbosity level.
std::string printHeader(void) const
Print iterate header.
std::string printName(void) const
Print step name.
std::string EDescentToString(EDescent tr)
Defines the linear algebra or vector space interface.
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
void compute(Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Compute step.
State for algorithm class. Will be used for restarts.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
ProjectedNewtonStep(ROL::ParameterList &parlist, const bool computeObj=true)
Constructor.
ROL::Ptr< StepState< Real > > getState(void)
ROL::Ptr< Vector< Real > > iterateVec
ROL::Ptr< Vector< Real > > d_
Additional vector storage.
virtual void invHessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply inverse Hessian approximation to vector.
virtual void project(Vector< Real > &x)
Project optimization variables onto the bounds.
void pruneInactive(Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the -inactive set.
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 upper and lower bound constraints.
void computeProjectedGradient(Vector< Real > &g, const Vector< Real > &x)
Compute projected gradient.
void update(Vector< Real > &x, const Vector< Real > &s, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Update step, if successful.
bool useProjectedGrad_
Whether or not to use to the projected gradient criticality measure.
virtual void initialize(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Initialize step with bound constraint.
void initialize(Vector< Real > &x, const Vector< Real > &s, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Initialize step with bound constraint.
virtual Real norm() const =0
Returns where .
std::string print(AlgorithmState< Real > &algo_state, bool print_header=false) const
Print iterate status.