44 #ifndef ROL_LINESEARCHSTEP_H 
   45 #define ROL_LINESEARCHSTEP_H 
  137 template <
class Real>
 
  147   ROL::Ptr<Vector<Real> > 
d_;
 
  209                   const ROL::Ptr<NonlinearCG<Real> > &nlcg = ROL::nullPtr )
 
  215     ROL::ParameterList& Llist = parlist.sublist(
"Step").sublist(
"Line Search");
 
  216     ROL::ParameterList& Glist = parlist.sublist(
"General");
 
  220     computeObj_ = Glist.get(
"Recompute Objective Function",
false);
 
  223       lineSearchName_ = Llist.sublist(
"Line-Search Method").get(
"Type",
"Cubic Interpolation"); 
 
  228       lineSearchName_ = Llist.sublist(
"Line-Search Method").get(
"User Defined Line-Search Name",
 
  229                                                                 "Unspecified User Defined Line-Search");
 
  240     ROL::ParameterList& list
 
  241       = 
parlist_.sublist(
"Step").sublist(
"Line Search").sublist(
"Descent Method");
 
  266           ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
 
  267             ">>> (LineSearchStep::Initialize): Undefined descent type!");
 
  293           ROL_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
 
  294             ">>> (LineSearchStep::Initialize): Undefined descent type!");
 
  297     desc_->initialize(x,s,g,obj,bnd,algo_state);
 
  321     Real 
zero(0), one(1);
 
  323     desc_->compute(s,x,obj,bnd,algo_state);
 
  327     const ROL::Ptr<const StepState<Real> > desc_state = 
desc_->getStepState();
 
  330       s.
set((desc_state->gradientVec)->dual());
 
  338     step_state->nfval = 0; step_state->ngrad = 0;
 
  340     lineSearch_->run(step_state->searchSize,
fval_,step_state->nfval,step_state->ngrad,gs,s,x,obj,bnd);
 
  348     s.
scale(step_state->searchSize);
 
  352       s.
axpy(static_cast<Real>(-1),x);
 
  371     algo_state.
nfval += step_state->nfval;
 
  372     algo_state.
ngrad += step_state->ngrad;
 
  373     desc_->update(x,s,obj,bnd,algo_state);
 
  374     step_state->flag = 
desc_->getStepState()->flag;
 
  375     step_state->SPiter = 
desc_->getStepState()->SPiter;
 
  376     step_state->SPflag = 
desc_->getStepState()->SPflag;
 
  387     std::string head = 
desc_->printHeader();
 
  388     head.erase(std::remove(head.end()-3,head.end(),
'\n'), head.end());
 
  389     std::stringstream hist;
 
  390     hist.write(head.c_str(),head.length());
 
  391     hist << std::setw(10) << std::left << 
"ls_#fval";
 
  392     hist << std::setw(10) << std::left << 
"ls_#grad";
 
  402     std::string name = 
desc_->printName();
 
  403     std::stringstream hist;
 
  419     std::string desc = 
desc_->print(algo_state,
false);
 
  420     desc.erase(std::remove(desc.end()-3,desc.end(),
'\n'), desc.end());
 
  421     std::string name = 
desc_->printName();
 
  422     size_t pos = desc.find(name);
 
  423     if ( pos != std::string::npos ) {
 
  424       desc.erase(pos, name.length());
 
  427     std::stringstream hist;
 
  428     if ( algo_state.
iter == 0 ) {
 
  431     if ( print_header ) {
 
  435     if ( algo_state.
iter == 0 ) {
 
  439       hist << std::setw(10) << std::left << step_state->nfval;              
 
  440       hist << std::setw(10) << std::left << step_state->ngrad;
 
Provides the interface to evaluate objective functions. 
virtual const Vector & dual() const 
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
virtual void scale(const Real alpha)=0
Compute  where . 
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector. 
virtual void plus(const Vector &x)=0
Compute , where . 
bool acceptLastAlpha_
For backwards compatibility. When max function evaluations are reached take last step. 
virtual void axpy(const Real alpha, const Vector &x)
Compute  where . 
ELineSearch StringToELineSearch(std::string s)
Real GradDotStep(const Vector< Real > &g, const Vector< Real > &s, const Vector< Real > &x, BoundConstraint< Real > &bnd, Real eps=0)
bool isActivated(void) const 
Check if bounds are on. 
std::string printName(void) const 
Print step name. 
Provides the interface to compute optimization steps. 
Contains definitions of custom data types in ROL. 
LineSearchStep(ROL::ParameterList &parlist, const ROL::Ptr< LineSearch< Real > > &lineSearch=ROL::nullPtr, const ROL::Ptr< Secant< Real > > &secant=ROL::nullPtr, const ROL::Ptr< Krylov< Real > > &krylov=ROL::nullPtr, const ROL::Ptr< NonlinearCG< Real > > &nlcg=ROL::nullPtr)
Constructor. 
void pruneInactive(Vector< Real > &v, const Vector< Real > &x, Real eps=0)
Set variables to zero if they correspond to the -inactive set. 
ROL::ParameterList parlist_
void update(Vector< Real > &x, const Vector< Real > &s, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Update step, if successful. 
ELineSearch
Enumeration of line-search types. 
void pruneActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0)
Set variables to zero if they correspond to the -active set. 
bool usePreviousAlpha_
If true, use the previously accepted step length (if any) as the new initial step length...
std::string printHeader(void) const 
Print iterate header. 
Defines the linear algebra or vector space interface. 
virtual Real dot(const Vector &x) const =0
Compute  where . 
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
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. 
EDescent StringToEDescent(std::string s)
State for algorithm class. Will be used for restarts. 
Provides the interface to compute optimization steps with line search. 
std::string ECurvatureConditionToString(ECurvatureCondition ls)
ROL::Ptr< NonlinearCG< Real > > nlcg_
Nonlinear CG object (used for nonlinear CG) 
Provides interface for and implements line searches. 
ROL::Ptr< StepState< Real > > getState(void)
Provides interface for and implements limited-memory secant operators. 
ROL::Ptr< Step< Real > > desc_
Unglobalized step object. 
ELineSearch els_
enum determines type of line search 
std::string print(AlgorithmState< Real > &algo_state, bool print_header=false) const 
Print iterate status. 
Provides definitions for Krylov solvers. 
Provides the interface to apply upper and lower bound constraints. 
ROL::Ptr< LineSearch< Real > > lineSearch_
Line-search object. 
void compute(Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Compute step. 
ROL::Ptr< Vector< Real > > d_
ECurvatureCondition
Enumeration of line-search curvature conditions. 
virtual void set(const Vector &x)
Set  where . 
ECurvatureCondition StringToECurvatureCondition(std::string s)
ROL::Ptr< Krylov< Real > > krylov_
Krylov solver object (used for inexact Newton) 
EDescent
Enumeration of descent direction types. 
ECurvatureCondition econd_
enum determines type of curvature condition 
virtual void project(Vector< Real > &x)
Project optimization variables onto the bounds. 
ROL::Ptr< Secant< Real > > secant_
Secant object (used for quasi-Newton) 
std::string lineSearchName_
const ROL::Ptr< const StepState< Real > > getStepState(void) const 
Get state for step object.