10 #ifndef ROL_PROJECTEDSECANTSTEP_H
11 #define ROL_PROJECTEDSECANTSTEP_H
31 ROL::Ptr<Vector<Real> >
d_;
32 ROL::Ptr<Vector<Real> >
gp_;
53 const bool computeObj =
true )
57 ROL::ParameterList& Glist = parlist.sublist(
"General");
59 verbosity_ = parlist.sublist(
"General").get(
"Print Verbosity",0);
61 if ( secant == ROL::nullPtr ) {
62 std::string secantType = parlist.sublist(
"General").sublist(
"Secant").get(
"Type",
"Limited-Memory BFGS");
64 secant_ = SecantFactory<Real>(parlist);
84 gp_->set(*(step_state->gradientVec));
89 gp_->set(*(step_state->gradientVec));
98 Real tol = std::sqrt(ROL_EPSILON<Real>()), one(1);
106 (step_state->descentVec)->set(x);
107 (step_state->descentVec)->axpy(-one,*
d_);
111 gp_->set(*(step_state->gradientVec));
117 obj.
gradient(*(step_state->gradientVec),x,tol);
121 secant_->updateStorage(x,*(step_state->gradientVec),*
gp_,s,algo_state.
snorm,algo_state.
iter+1);
126 gp_->set(*(step_state->gradientVec));
132 d_->axpy(-one,(step_state->gradientVec)->dual());
140 std::stringstream hist;
143 hist << std::string(109,
'-') <<
"\n";
145 hist <<
" status output definitions\n\n";
146 hist <<
" iter - Number of iterates (steps taken) \n";
147 hist <<
" value - Objective function value \n";
148 hist <<
" gnorm - Norm of the gradient\n";
149 hist <<
" snorm - Norm of the step (update to optimization vector)\n";
150 hist <<
" #fval - Cumulative number of times the objective function was evaluated\n";
151 hist <<
" #grad - Number of times the gradient was computed\n";
152 hist << std::string(109,
'-') <<
"\n";
156 hist << std::setw(6) << std::left <<
"iter";
157 hist << std::setw(15) << std::left <<
"value";
158 hist << std::setw(15) << std::left <<
"gnorm";
159 hist << std::setw(15) << std::left <<
"snorm";
160 hist << std::setw(10) << std::left <<
"#fval";
161 hist << std::setw(10) << std::left <<
"#grad";
166 std::stringstream hist;
172 std::stringstream hist;
173 hist << std::scientific << std::setprecision(6);
174 if ( algo_state.
iter == 0 ) {
177 if ( print_header ) {
180 if ( algo_state.
iter == 0 ) {
182 hist << std::setw(6) << std::left << algo_state.
iter;
183 hist << std::setw(15) << std::left << algo_state.
value;
184 hist << std::setw(15) << std::left << algo_state.
gnorm;
189 hist << std::setw(6) << std::left << algo_state.
iter;
190 hist << std::setw(15) << std::left << algo_state.
value;
191 hist << std::setw(15) << std::left << algo_state.
gnorm;
192 hist << std::setw(15) << std::left << algo_state.
snorm;
193 hist << std::setw(10) << std::left << algo_state.
nfval;
194 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.
int verbosity_
Verbosity level.
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...
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
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.
virtual void project(Vector< Real > &x)
Project optimization variables onto the bounds.
void pruneInactive(Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the -inactive set.
void pruneActive(Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the -active set.
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 .
std::string ESecantToString(ESecant tr)
std::string print(AlgorithmState< Real > &algo_state, bool print_header=false) const
Print iterate status.