44 #ifndef ROL_PROJECTEDNEWTONSTEP_H
45 #define ROL_PROJECTEDNEWTONSTEP_H
62 ROL::Ptr<Vector<Real> >
gp_;
63 ROL::Ptr<Vector<Real> >
d_;
82 :
Step<Real>(),
gp_(ROL::nullPtr),
d_(ROL::nullPtr),
85 ROL::ParameterList& Glist = parlist.sublist(
"General");
87 verbosity_ = parlist.sublist(
"General").get(
"Print Verbosity",0);
101 Real tol = std::sqrt(ROL_EPSILON<Real>()), one(1);
106 gp_->set(*(step_state->gradientVec));
111 gp_->set(*(step_state->gradientVec));
120 Real tol = std::sqrt(ROL_EPSILON<Real>()), one(1);
128 (step_state->descentVec)->set(x);
129 (step_state->descentVec)->axpy(-one,*
d_);
138 obj.
gradient(*(step_state->gradientVec),x,tol);
144 gp_->set(*(step_state->gradientVec));
150 d_->axpy(-one,(step_state->gradientVec)->dual());
158 std::stringstream hist;
161 hist << std::string(109,
'-') <<
"\n";
163 hist <<
" status output definitions\n\n";
164 hist <<
" iter - Number of iterates (steps taken) \n";
165 hist <<
" value - Objective function value \n";
166 hist <<
" gnorm - Norm of the gradient\n";
167 hist <<
" snorm - Norm of the step (update to optimization vector)\n";
168 hist <<
" #fval - Cumulative number of times the objective function was evaluated\n";
169 hist <<
" #grad - Number of times the gradient was computed\n";
170 hist << std::string(109,
'-') <<
"\n";
174 hist << std::setw(6) << std::left <<
"iter";
175 hist << std::setw(15) << std::left <<
"value";
176 hist << std::setw(15) << std::left <<
"gnorm";
177 hist << std::setw(15) << std::left <<
"snorm";
178 hist << std::setw(10) << std::left <<
"#fval";
179 hist << std::setw(10) << std::left <<
"#grad";
184 std::stringstream hist;
189 std::stringstream hist;
190 hist << std::scientific << std::setprecision(6);
191 if ( algo_state.
iter == 0 ) {
194 if ( print_header ) {
197 if ( algo_state.
iter == 0 ) {
199 hist << std::setw(6) << std::left << algo_state.
iter;
200 hist << std::setw(15) << std::left << algo_state.
value;
201 hist << std::setw(15) << std::left << algo_state.
gnorm;
206 hist << std::setw(6) << std::left << algo_state.
iter;
207 hist << std::setw(15) << std::left << algo_state.
value;
208 hist << std::setw(15) << std::left << algo_state.
gnorm;
209 hist << std::setw(15) << std::left << algo_state.
snorm;
210 hist << std::setw(10) << std::left << algo_state.
nfval;
211 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.
void pruneInactive(Vector< Real > &v, const Vector< Real > &x, Real eps=0)
Set variables to zero if they correspond to the -inactive set.
void pruneActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0)
Set variables to zero if they correspond to the -active set.
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.
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.
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 .
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
std::string print(AlgorithmState< Real > &algo_state, bool print_header=false) const
Print iterate status.
virtual void project(Vector< Real > &x)
Project optimization variables onto the bounds.