44 #ifndef ROL_PROJECTEDSECANTSTEP_H
45 #define ROL_PROJECTEDSECANTSTEP_H
65 ROL::Ptr<Vector<Real> >
d_;
66 ROL::Ptr<Vector<Real> >
gp_;
87 const bool computeObj =
true )
91 ROL::ParameterList& Glist = parlist.sublist(
"General");
93 verbosity_ = parlist.sublist(
"General").get(
"Print Verbosity",0);
95 if ( secant == ROL::nullPtr ) {
96 esec_ =
StringToESecant(parlist.sublist(
"General").sublist(
"Secant").get(
"Type",
"Limited-Memory BFGS"));
97 secant_ = SecantFactory<Real>(parlist);
117 gp_->set(*(step_state->gradientVec));
122 gp_->set(*(step_state->gradientVec));
131 Real tol = std::sqrt(ROL_EPSILON<Real>()), one(1);
139 (step_state->descentVec)->set(x);
140 (step_state->descentVec)->axpy(-one,*
d_);
144 gp_->set(*(step_state->gradientVec));
150 obj.
gradient(*(step_state->gradientVec),x,tol);
154 secant_->updateStorage(x,*(step_state->gradientVec),*
gp_,s,algo_state.
snorm,algo_state.
iter+1);
159 gp_->set(*(step_state->gradientVec));
165 d_->axpy(-one,(step_state->gradientVec)->dual());
173 std::stringstream hist;
176 hist << std::string(109,
'-') <<
"\n";
178 hist <<
" status output definitions\n\n";
179 hist <<
" iter - Number of iterates (steps taken) \n";
180 hist <<
" value - Objective function value \n";
181 hist <<
" gnorm - Norm of the gradient\n";
182 hist <<
" snorm - Norm of the step (update to optimization vector)\n";
183 hist <<
" #fval - Cumulative number of times the objective function was evaluated\n";
184 hist <<
" #grad - Number of times the gradient was computed\n";
185 hist << std::string(109,
'-') <<
"\n";
189 hist << std::setw(6) << std::left <<
"iter";
190 hist << std::setw(15) << std::left <<
"value";
191 hist << std::setw(15) << std::left <<
"gnorm";
192 hist << std::setw(15) << std::left <<
"snorm";
193 hist << std::setw(10) << std::left <<
"#fval";
194 hist << std::setw(10) << std::left <<
"#grad";
199 std::stringstream hist;
205 std::stringstream hist;
206 hist << std::scientific << std::setprecision(6);
207 if ( algo_state.
iter == 0 ) {
210 if ( print_header ) {
213 if ( algo_state.
iter == 0 ) {
215 hist << std::setw(6) << std::left << algo_state.
iter;
216 hist << std::setw(15) << std::left << algo_state.
value;
217 hist << std::setw(15) << std::left << algo_state.
gnorm;
222 hist << std::setw(6) << std::left << algo_state.
iter;
223 hist << std::setw(15) << std::left << algo_state.
value;
224 hist << std::setw(15) << std::left << algo_state.
gnorm;
225 hist << std::setw(15) << std::left << algo_state.
snorm;
226 hist << std::setw(10) << std::left << algo_state.
nfval;
227 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.
ROL::Ptr< Vector< Real > > d_
Additional vector storage.
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.
Contains definitions of custom data types in ROL.
ROL::Ptr< Vector< Real > > gp_
Additional vector storage.
void pruneInactive(Vector< Real > &v, const Vector< Real > &x, Real eps=0)
Set variables to zero if they correspond to the -inactive set.
int verbosity_
Verbosity level.
void pruneActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0)
Set variables to zero if they correspond to the -active set.
ESecant StringToESecant(std::string s)
std::string EDescentToString(EDescent tr)
void update(Vector< Real > &x, const Vector< Real > &s, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Update step, if successful.
ProjectedSecantStep(ROL::ParameterList &parlist, const ROL::Ptr< Secant< Real > > &secant=ROL::nullPtr, const bool computeObj=true)
Constructor.
Defines the linear algebra or vector space interface.
Provides the interface to compute optimization steps with projected secant method using line search...
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.
ROL::Ptr< Secant< Real > > secant_
Secant object (used for quasi-Newton)
ESecant
Enumeration of secant update algorithms.
ROL::Ptr< StepState< Real > > getState(void)
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.
bool useProjectedGrad_
Whether or not to use to the projected gradient criticality measure.
Provides interface for and implements limited-memory secant operators.
ROL::Ptr< Vector< Real > > iterateVec
std::string printName(void) const
Print step name.
Provides the interface to apply upper and lower bound constraints.
void computeProjectedGradient(Vector< Real > &g, const Vector< Real > &x)
Compute projected gradient.
std::string printHeader(void) const
Print iterate header.
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.
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 ESecantToString(ESecant tr)
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.