44 #ifndef ROL_GRADIENTSTEP_H
45 #define ROL_GRADIENTSTEP_H
79 GradientStep( ROL::ParameterList &parlist,
const bool computeObj =
true )
82 verbosity_ = parlist.sublist(
"General").get(
"Print Verbosity",0);
92 s.
set((step_state->gradientVec)->dual());
98 Real tol = std::sqrt(ROL_EPSILON<Real>());
104 (step_state->descentVec)->set(s);
113 obj.
gradient(*(step_state->gradientVec),x,tol);
118 algo_state.
gnorm = (step_state->gradientVec)->norm();
122 std::stringstream hist;
125 hist << std::string(109,
'-') <<
"\n";
127 hist <<
" status output definitions\n\n";
128 hist <<
" iter - Number of iterates (steps taken) \n";
129 hist <<
" value - Objective function value \n";
130 hist <<
" gnorm - Norm of the gradient\n";
131 hist <<
" snorm - Norm of the step (update to optimization vector)\n";
132 hist <<
" #fval - Cumulative number of times the objective function was evaluated\n";
133 hist <<
" #grad - Number of times the gradient was computed\n";
134 hist << std::string(109,
'-') <<
"\n";
138 hist << std::setw(6) << std::left <<
"iter";
139 hist << std::setw(15) << std::left <<
"value";
140 hist << std::setw(15) << std::left <<
"gnorm";
141 hist << std::setw(15) << std::left <<
"snorm";
142 hist << std::setw(10) << std::left <<
"#fval";
143 hist << std::setw(10) << std::left <<
"#grad";
148 std::stringstream hist;
153 std::stringstream hist;
154 hist << std::scientific << std::setprecision(6);
155 if ( algo_state.
iter == 0 ) {
158 if ( print_header ) {
161 if ( algo_state.
iter == 0 ) {
163 hist << std::setw(6) << std::left << algo_state.
iter;
164 hist << std::setw(15) << std::left << algo_state.
value;
165 hist << std::setw(15) << std::left << algo_state.
gnorm;
170 hist << std::setw(6) << std::left << algo_state.
iter;
171 hist << std::setw(15) << std::left << algo_state.
value;
172 hist << std::setw(15) << std::left << algo_state.
gnorm;
173 hist << std::setw(15) << std::left << algo_state.
snorm;
174 hist << std::setw(10) << std::left << algo_state.
nfval;
175 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 void plus(const Vector &x)=0
Compute , where .
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Provides the interface to compute optimization steps.
std::string print(AlgorithmState< Real > &algo_state, bool print_header=false) const
Print iterate status.
Contains definitions of custom data types in ROL.
void compute(Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Compute step.
std::string EDescentToString(EDescent tr)
GradientStep(ROL::ParameterList &parlist, const bool computeObj=true)
Constructor.
Defines the linear algebra or vector space interface.
State for algorithm class. Will be used for restarts.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
std::string printHeader(void) const
Print iterate header.
ROL::Ptr< StepState< Real > > getState(void)
ROL::Ptr< Vector< Real > > iterateVec
int verbosity_
Verbosity setting.
Provides the interface to apply upper and lower bound constraints.
void update(Vector< Real > &x, const Vector< Real > &s, Objective< Real > &obj, BoundConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Update step, if successful.
virtual void set(const Vector &x)
Set where .
virtual Real norm() const =0
Returns where .
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
Provides the interface to compute optimization steps with the gradient descent method globalized usin...
std::string printName(void) const
Print step name.
const bool computeObj_
Allows line search to compute objective.