// Constructor LineSearch( Teuchos::ParameterList &parlist ) : eps_(0.0) { // Enumerations edesc_ = StringToEDescent(parlist.get("Descent Type","Quasi-Newton Method")); econd_ = StringToECurvatureCondition( parlist.get("Linesearch Curvature Condition","Strong Wolfe Conditions")); // Linesearc Parameters maxit_ = parlist.get("Maximum Number of Function Evaluations", 20); c1_ = parlist.get("Sufficient Decrease Parameter", 1.e-4); c2_ = parlist.get("Curvature Conditions Parameter", 0.9); c3_ = parlist.get("Curvature Conditions Parameter: Generalized Wolfe", 0.6); alpha0_ = parlist.get("Initial Linesearch Parameter",1.0); useralpha_ = parlist.get("User Defined Linesearch Parameter",false); if ( c1_ < 0.0 ) { c1_ = 1.e-4; } if ( c2_ < 0.0 ) { c2_ = 0.9; } if ( c3_ < 0.0 ) { c3_ = 0.9; } if ( c2_ <= c1_ ) { c1_ = 1.e-4; c2_ = 0.9; } if ( edesc_ == DESCENT_NONLINEARCG ) { c2_ = 0.4; c3_ = std::min(1.0-c2_,c3_); } }
// Constructor LineSearch( Teuchos::ParameterList &parlist ) : eps_(0.0) { // Enumerations edesc_ = StringToEDescent(parlist.sublist("Step").sublist("Line Search").sublist("Descent Method").get("Type","Quasi-Newton Method")); econd_ = StringToECurvatureCondition(parlist.sublist("Step").sublist("Line Search").sublist("Curvature Condition").get("Type","Strong Wolfe Conditions")); // Linesearc Parameters alpha0_ = parlist.sublist("Step").sublist("Line Search").get("Initial Step Size",1.0); useralpha_ = parlist.sublist("Step").sublist("Line Search").get("User Defined Initial Step Size",false); acceptMin_ = parlist.sublist("Step").sublist("Line Search").get("Accept Linesearch Minimizer",false); maxit_ = parlist.sublist("Step").sublist("Line Search").get("Function Evaluation Limit",20); c1_ = parlist.sublist("Step").sublist("Line Search").get("Sufficient Decrease Tolerance",1.e-4); c2_ = parlist.sublist("Step").sublist("Line Search").sublist("Curvature Condition").get("General Parameter",0.9); c3_ = parlist.sublist("Step").sublist("Line Search").sublist("Curvature Condition").get("Generalized Wolfe Parameter",0.6); fmin_ = std::numeric_limits<Real>::max(); alphaMin_ = 0; itcond_ = false; c1_ = ((c1_ < 0.0) ? 1.e-4 : c1_); c2_ = ((c2_ < 0.0) ? 0.9 : c2_); c3_ = ((c3_ < 0.0) ? 0.9 : c3_); if ( c2_ <= c1_ ) { c1_ = 1.e-4; c2_ = 0.9; } if ( edesc_ == DESCENT_NONLINEARCG ) { c2_ = 0.4; c3_ = std::min(1.0-c2_,c3_); } }
/** \brief Constructor. Standard constructor to build a LineSearchStep object. Algorithmic specifications are passed in through a Teuchos::ParameterList. @param[in] parlist is a parameter list containing algorithmic specifications */ LineSearchStep( Teuchos::ParameterList &parlist ) : Step<Real>(), secant_(Teuchos::null), krylov_(Teuchos::null), nlcg_(Teuchos::null), lineSearch_(Teuchos::null), hessian_(Teuchos::null), precond_(Teuchos::null), d_(Teuchos::null), gp_(Teuchos::null), iterKrylov_(0), flagKrylov_(0), els_(LINESEARCH_BACKTRACKING), enlcg_(NONLINEARCG_OREN_LUENBERGER), econd_(CURVATURECONDITION_WOLFE), edesc_(DESCENT_STEEPEST), esec_(SECANT_LBFGS), ekv_(KRYLOV_CG), ls_nfval_(0), ls_ngrad_(0), useSecantHessVec_(false), useSecantPrecond_(false), useProjectedGrad_(false) { Teuchos::ParameterList& Llist = parlist.sublist("Step").sublist("Line Search"); Teuchos::ParameterList& Glist = parlist.sublist("General"); // Initialize Linesearch Object edesc_ = StringToEDescent(Llist.sublist("Descent Method").get("Type","Quasi-Newton Method") ); els_ = StringToELineSearch(Llist.sublist("Line-Search Method").get("Type","Cubic Interpolation") ); econd_ = StringToECurvatureCondition(Llist.sublist("Curvature Condition").get("Type","Strong Wolfe Conditions") ); useProjectedGrad_ = Glist.get("Projected Gradient Criticality Measure", false); acceptLastAlpha_ = Llist.get("Accept Last Alpha", false); lineSearch_ = LineSearchFactory<Real>(parlist); // Inexactness Information useInexact_.clear(); useInexact_.push_back(Glist.get("Inexact Objective Function", false)); useInexact_.push_back(Glist.get("Inexact Gradient", false)); useInexact_.push_back(Glist.get("Inexact Hessian-Times-A-Vector", false)); // Initialize Krylov Object ekv_ = StringToEKrylov(Glist.sublist("Krylov").get("Type","Conjugate Gradients")); if ( edesc_ == DESCENT_NEWTONKRYLOV ) { krylov_ = KrylovFactory<Real>(parlist); } // Initialize Secant Object esec_ = StringToESecant(Glist.sublist("Secant").get("Type","Limited-Memory BFGS")); useSecantHessVec_ = Glist.sublist("Secant").get("Use as Hessian", false); useSecantHessVec_ = ((edesc_==DESCENT_SECANT) ? true : useSecantHessVec_); useSecantPrecond_ = Glist.sublist("Secant").get("Use as Preconditioner", false); if ( edesc_ == DESCENT_SECANT || (edesc_ == DESCENT_NEWTONKRYLOV && useSecantPrecond_) ) { secant_ = SecantFactory<Real>(parlist); } // Initialize Nonlinear CG Object enlcg_ = StringToENonlinearCG(Llist.sublist("Descent Method").get("Nonlinear CG Type","Oren-Luenberger")); if ( edesc_ == DESCENT_NONLINEARCG ) { nlcg_ = Teuchos::rcp( new NonlinearCG<Real>(enlcg_) ); } }