44 #ifndef ROL_SECANTSTEP_H 45 #define ROL_SECANTSTEP_H 65 Teuchos::RCP<Vector<Real> >
gp_;
85 const Teuchos::RCP<
Secant<Real> > &secant = Teuchos::null,
86 const bool computeObj =
true )
90 verbosity_ = parlist.sublist(
"General").get(
"Print Verbosity",0);
92 if ( secant == Teuchos::null ) {
93 esec_ =
StringToESecant(parlist.sublist(
"General").sublist(
"Secant").get(
"Type",
"Limited-Memory BFGS"));
94 secant_ = SecantFactory<Real>(parlist);
112 secant_->applyH(s,*(step_state->gradientVec));
118 Real tol = std::sqrt(ROL_EPSILON<Real>());
124 (step_state->descentVec)->
set(s);
128 gp_->set(*(step_state->gradientVec));
134 obj.
gradient(*(step_state->gradientVec),x,tol);
138 secant_->updateStorage(x,*(step_state->gradientVec),*
gp_,s,algo_state.
snorm,algo_state.
iter+1);
142 algo_state.
gnorm = (step_state->gradientVec)->norm();
146 std::stringstream hist;
149 hist << std::string(109,
'-') <<
"\n";
151 hist <<
" status output definitions\n\n";
152 hist <<
" iter - Number of iterates (steps taken) \n";
153 hist <<
" value - Objective function value \n";
154 hist <<
" gnorm - Norm of the gradient\n";
155 hist <<
" snorm - Norm of the step (update to optimization vector)\n";
156 hist <<
" #fval - Cumulative number of times the objective function was evaluated\n";
157 hist <<
" #grad - Number of times the gradient was computed\n";
158 hist << std::string(109,
'-') <<
"\n";
162 hist << std::setw(6) << std::left <<
"iter";
163 hist << std::setw(15) << std::left <<
"value";
164 hist << std::setw(15) << std::left <<
"gnorm";
165 hist << std::setw(15) << std::left <<
"snorm";
166 hist << std::setw(10) << std::left <<
"#fval";
167 hist << std::setw(10) << std::left <<
"#grad";
172 std::stringstream hist;
178 std::stringstream hist;
179 hist << std::scientific << std::setprecision(6);
180 if ( algo_state.
iter == 0 ) {
183 if ( print_header ) {
186 if ( algo_state.
iter == 0 ) {
188 hist << std::setw(6) << std::left << algo_state.
iter;
189 hist << std::setw(15) << std::left << algo_state.
value;
190 hist << std::setw(15) << std::left << algo_state.
gnorm;
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;
198 hist << std::setw(15) << std::left << algo_state.
snorm;
199 hist << std::setw(10) << std::left << algo_state.
nfval;
200 hist << std::setw(10) << std::left << algo_state.
ngrad;
std::string printHeader(void) const
Print iterate header.
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 .
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 .
Teuchos::RCP< Vector< Real > > gp_
Additional vector storage.
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Provides the interface to compute optimization steps.
Teuchos::RCP< StepState< Real > > getState(void)
Contains definitions of custom data types in ROL.
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
ESecant StringToESecant(std::string s)
std::string EDescentToString(EDescent tr)
Defines the linear algebra or vector space interface.
std::string print(AlgorithmState< Real > &algo_state, bool print_header=false) const
Print iterate status.
SecantStep(Teuchos::ParameterList &parlist, const Teuchos::RCP< Secant< Real > > &secant=Teuchos::null, const bool computeObj=true)
Constructor.
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.
Provides interface for and implements limited-memory secant operators.
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.
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.
Teuchos::RCP< Vector< Real > > iterateVec
virtual Real norm() const =0
Returns where .
Teuchos::RCP< Secant< Real > > secant_
Secant object (used for quasi-Newton)
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
std::string ESecantToString(ESecant tr)
std::string printName(void) const
Print step name.
Provides the interface to compute optimization steps with a secant method.