44 #ifndef ROL_SECANTSTEP_H
45 #define ROL_SECANTSTEP_H
65 ROL::Ptr<Vector<Real> >
gp_;
88 const bool computeObj =
true )
92 verbosity_ = parlist.sublist(
"General").get(
"Print Verbosity",0);
94 if ( secant == ROL::nullPtr ) {
95 secantName_ = parlist.sublist(
"General").sublist(
"Secant").get(
"Type",
"Limited-Memory BFGS");
97 secant_ = SecantFactory<Real>(parlist);
100 secantName_ = parlist.sublist(
"General").sublist(
"Secant").get(
"User Defined Secant Name",
101 "Unspecified User Defined Secant Method");
119 secant_->applyH(s,*(step_state->gradientVec));
125 Real tol = std::sqrt(ROL_EPSILON<Real>());
131 (step_state->descentVec)->set(s);
135 gp_->set(*(step_state->gradientVec));
141 obj.
gradient(*(step_state->gradientVec),x,tol);
145 secant_->updateStorage(x,*(step_state->gradientVec),*
gp_,s,algo_state.
snorm,algo_state.
iter+1);
149 algo_state.
gnorm = (step_state->gradientVec)->norm();
153 std::stringstream hist;
156 hist << std::string(109,
'-') <<
"\n";
158 hist <<
" status output definitions\n\n";
159 hist <<
" iter - Number of iterates (steps taken) \n";
160 hist <<
" value - Objective function value \n";
161 hist <<
" gnorm - Norm of the gradient\n";
162 hist <<
" snorm - Norm of the step (update to optimization vector)\n";
163 hist <<
" #fval - Cumulative number of times the objective function was evaluated\n";
164 hist <<
" #grad - Number of times the gradient was computed\n";
165 hist << std::string(109,
'-') <<
"\n";
169 hist << std::setw(6) << std::left <<
"iter";
170 hist << std::setw(15) << std::left <<
"value";
171 hist << std::setw(15) << std::left <<
"gnorm";
172 hist << std::setw(15) << std::left <<
"snorm";
173 hist << std::setw(10) << std::left <<
"#fval";
174 hist << std::setw(10) << std::left <<
"#grad";
179 std::stringstream hist;
185 std::stringstream hist;
186 hist << std::scientific << std::setprecision(6);
187 if ( algo_state.
iter == 0 ) {
190 if ( print_header ) {
193 if ( algo_state.
iter == 0 ) {
195 hist << std::setw(6) << std::left << algo_state.
iter;
196 hist << std::setw(15) << std::left << algo_state.
value;
197 hist << std::setw(15) << std::left << algo_state.
gnorm;
202 hist << std::setw(6) << std::left << algo_state.
iter;
203 hist << std::setw(15) << std::left << algo_state.
value;
204 hist << std::setw(15) << std::left << algo_state.
gnorm;
205 hist << std::setw(15) << std::left << algo_state.
snorm;
206 hist << std::setw(10) << std::left << algo_state.
nfval;
207 hist << std::setw(10) << std::left << algo_state.
ngrad;
Provides the interface to evaluate objective functions.
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.
virtual void scale(const Real alpha)=0
Compute where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
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 plus(const Vector &x)=0
Compute , where .
SecantStep(ROL::ParameterList &parlist, const ROL::Ptr< Secant< Real > > &secant=ROL::nullPtr, const bool computeObj=true)
Constructor.
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.
ESecant StringToESecant(std::string s)
std::string EDescentToString(EDescent tr)
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.
ESecant
Enumeration of secant update algorithms.
std::string printHeader(void) const
Print iterate header.
ROL::Ptr< StepState< Real > > getState(void)
Provides interface for and implements limited-memory secant operators.
ROL::Ptr< Vector< Real > > iterateVec
std::string printName(void) const
Print step name.
void compute(Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Compute step.
Provides the interface to apply upper and lower bound constraints.
int verbosity_
Verbosity setting.
ROL::Ptr< Secant< Real > > secant_
Secant object (used for quasi-Newton)
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.
std::string print(AlgorithmState< Real > &algo_state, bool print_header=false) const
Print iterate status.
virtual Real norm() const =0
Returns where .
ROL::Ptr< Vector< Real > > gp_
Additional vector storage.
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
Provides the interface to compute optimization steps with a secant method.