10 #ifndef ROL_SECANTSTEP_H
11 #define ROL_SECANTSTEP_H
31 ROL::Ptr<Vector<Real> >
gp_;
54 const bool computeObj =
true )
58 verbosity_ = parlist.sublist(
"General").get(
"Print Verbosity",0);
60 if ( secant == ROL::nullPtr ) {
61 secantName_ = parlist.sublist(
"General").sublist(
"Secant").get(
"Type",
"Limited-Memory BFGS");
63 secant_ = SecantFactory<Real>(parlist);
66 secantName_ = parlist.sublist(
"General").sublist(
"Secant").get(
"User Defined Secant Name",
67 "Unspecified User Defined Secant Method");
85 secant_->applyH(s,*(step_state->gradientVec));
91 Real tol = std::sqrt(ROL_EPSILON<Real>());
97 (step_state->descentVec)->set(s);
101 gp_->set(*(step_state->gradientVec));
107 obj.
gradient(*(step_state->gradientVec),x,tol);
111 secant_->updateStorage(x,*(step_state->gradientVec),*
gp_,s,algo_state.
snorm,algo_state.
iter+1);
115 algo_state.
gnorm = (step_state->gradientVec)->norm();
119 std::stringstream hist;
122 hist << std::string(109,
'-') <<
"\n";
124 hist <<
" status output definitions\n\n";
125 hist <<
" iter - Number of iterates (steps taken) \n";
126 hist <<
" value - Objective function value \n";
127 hist <<
" gnorm - Norm of the gradient\n";
128 hist <<
" snorm - Norm of the step (update to optimization vector)\n";
129 hist <<
" #fval - Cumulative number of times the objective function was evaluated\n";
130 hist <<
" #grad - Number of times the gradient was computed\n";
131 hist << std::string(109,
'-') <<
"\n";
135 hist << std::setw(6) << std::left <<
"iter";
136 hist << std::setw(15) << std::left <<
"value";
137 hist << std::setw(15) << std::left <<
"gnorm";
138 hist << std::setw(15) << std::left <<
"snorm";
139 hist << std::setw(10) << std::left <<
"#fval";
140 hist << std::setw(10) << std::left <<
"#grad";
145 std::stringstream hist;
151 std::stringstream hist;
152 hist << std::scientific << std::setprecision(6);
153 if ( algo_state.
iter == 0 ) {
156 if ( print_header ) {
159 if ( algo_state.
iter == 0 ) {
161 hist << std::setw(6) << std::left << algo_state.
iter;
162 hist << std::setw(15) << std::left << algo_state.
value;
163 hist << std::setw(15) << std::left << algo_state.
gnorm;
168 hist << std::setw(6) << std::left << algo_state.
iter;
169 hist << std::setw(15) << std::left << algo_state.
value;
170 hist << std::setw(15) << std::left << algo_state.
gnorm;
171 hist << std::setw(15) << std::left << algo_state.
snorm;
172 hist << std::setw(10) << std::left << algo_state.
nfval;
173 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.
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
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.
Provides the interface to compute optimization steps with a secant method.