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 esec_ =
StringToESecant(parlist.sublist(
"General").sublist(
"Secant").get(
"Type",
"Limited-Memory BFGS"));
63 secant_ = SecantFactory<Real>(parlist);
83 gp_->set(*(step_state->gradientVec));
88 gp_->set(*(step_state->gradientVec));
97 Real tol = std::sqrt(ROL_EPSILON<Real>()), one(1);
105 (step_state->descentVec)->set(x);
106 (step_state->descentVec)->axpy(-one,*
d_);
110 gp_->set(*(step_state->gradientVec));
116 obj.
gradient(*(step_state->gradientVec),x,tol);
120 secant_->updateStorage(x,*(step_state->gradientVec),*
gp_,s,algo_state.
snorm,algo_state.
iter+1);
125 gp_->set(*(step_state->gradientVec));
131 d_->axpy(-one,(step_state->gradientVec)->dual());
139 std::stringstream hist;
142 hist << std::string(109,
'-') <<
"\n";
144 hist <<
" status output definitions\n\n";
145 hist <<
" iter - Number of iterates (steps taken) \n";
146 hist <<
" value - Objective function value \n";
147 hist <<
" gnorm - Norm of the gradient\n";
148 hist <<
" snorm - Norm of the step (update to optimization vector)\n";
149 hist <<
" #fval - Cumulative number of times the objective function was evaluated\n";
150 hist <<
" #grad - Number of times the gradient was computed\n";
151 hist << std::string(109,
'-') <<
"\n";
155 hist << std::setw(6) << std::left <<
"iter";
156 hist << std::setw(15) << std::left <<
"value";
157 hist << std::setw(15) << std::left <<
"gnorm";
158 hist << std::setw(15) << std::left <<
"snorm";
159 hist << std::setw(10) << std::left <<
"#fval";
160 hist << std::setw(10) << std::left <<
"#grad";
165 std::stringstream hist;
171 std::stringstream hist;
172 hist << std::scientific << std::setprecision(6);
173 if ( algo_state.
iter == 0 ) {
176 if ( print_header ) {
179 if ( algo_state.
iter == 0 ) {
181 hist << std::setw(6) << std::left << algo_state.
iter;
182 hist << std::setw(15) << std::left << algo_state.
value;
183 hist << std::setw(15) << std::left << algo_state.
gnorm;
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;
191 hist << std::setw(15) << std::left << algo_state.
snorm;
192 hist << std::setw(10) << std::left << algo_state.
nfval;
193 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.