Public Member Functions | Protected Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
SNLLOptimizer Class Reference

Wrapper class for the OPT++ optimization library. More...

Inheritance diagram for SNLLOptimizer:
Optimizer SNLLBase Minimizer Iterator

List of all members.

Public Member Functions

 SNLLOptimizer (Model &model)
 standard constructor
 SNLLOptimizer (const String &method_name, Model &model)
 alternate constructor for instantiations "on the fly"
 SNLLOptimizer (const RealVector &initial_pt, const RealVector &var_l_bnds, const RealVector &var_u_bnds, const RealMatrix &lin_ineq_coeffs, const RealVector &lin_ineq_l_bnds, const RealVector &lin_ineq_u_bnds, const RealMatrix &lin_eq_coeffs, const RealVector &lin_eq_tgts, const RealVector &nln_ineq_l_bnds, const RealVector &nln_ineq_u_bnds, const RealVector &nln_eq_tgts, void(*user_obj_eval)(int mode, int n, const NEWMAT::ColumnVector &x, NEWMAT::Real &f, NEWMAT::ColumnVector &grad_f, int &result_mode), void(*user_con_eval)(int mode, int n, const NEWMAT::ColumnVector &x, NEWMAT::ColumnVector &g, NEWMAT::Matrix &grad_g, int &result_mode))
 alternate constructor for instantiations "on the fly"
 ~SNLLOptimizer ()
 destructor
void find_optimum ()
 Performs the iterations to determine the optimal solution.

Protected Member Functions

void initialize_run ()
 invokes Optimizer::initialize_run(), SNLLBase::snll_initialize_run(), and performs other set-up
void post_run (std::ostream &s)
 performs data recovery and calls Optimizer::post_run()
void finalize_run ()
 performs cleanup, restores instances and calls parent finalize

Static Private Member Functions

static void nlf0_evaluator (int n, const NEWMAT::ColumnVector &x, NEWMAT::Real &f, int &result_mode)
 objective function evaluator function for OPT++ methods which require only function values.
static void nlf1_evaluator (int mode, int n, const NEWMAT::ColumnVector &x, NEWMAT::Real &f, NEWMAT::ColumnVector &grad_f, int &result_mode)
 objective function evaluator function which provides function values and gradients to OPT++ methods.
static void nlf2_evaluator (int mode, int n, const NEWMAT::ColumnVector &x, NEWMAT::Real &f, NEWMAT::ColumnVector &grad_f, NEWMAT::SymmetricMatrix &hess_f, int &result_mode)
 objective function evaluator function which provides function values, gradients, and Hessians to OPT++ methods.
static void constraint0_evaluator (int n, const NEWMAT::ColumnVector &x, NEWMAT::ColumnVector &g, int &result_mode)
 constraint evaluator function for OPT++ methods which require only constraint values.
static void constraint1_evaluator (int mode, int n, const NEWMAT::ColumnVector &x, NEWMAT::ColumnVector &g, NEWMAT::Matrix &grad_g, int &result_mode)
 constraint evaluator function which provides constraint values and gradients to OPT++ methods.
static void constraint2_evaluator (int mode, int n, const NEWMAT::ColumnVector &x, NEWMAT::ColumnVector &g, NEWMAT::Matrix &grad_g, OPTPP::OptppArray< NEWMAT::SymmetricMatrix > &hess_g, int &result_mode)
 constraint evaluator function which provides constraint values, gradients, and Hessians to OPT++ methods.

Private Attributes

SNLLOptimizerprevSnllOptInstance
 pointer to the previously active object instance used for restoration in the case of iterator/model recursion
OPTPP::NLP0 * nlfObjective
 objective NLF base class pointer
OPTPP::NLP0 * nlfConstraint
 constraint NLF base class pointer
OPTPP::NLP * nlpConstraint
 constraint NLP pointer
OPTPP::NLF0 * nlf0
 pointer to objective NLF for nongradient optimizers
OPTPP::NLF1 * nlf1
 pointer to objective NLF for (analytic) gradient-based optimizers
OPTPP::NLF1 * nlf1Con
 pointer to constraint NLF for (analytic) gradient-based optimizers
OPTPP::FDNLF1 * fdnlf1
 pointer to objective NLF for (finite diff) gradient-based optimizers
OPTPP::FDNLF1 * fdnlf1Con
 pointer to constraint NLF for (finite diff) gradient-based optimizers
OPTPP::NLF2 * nlf2
 pointer to objective NLF for full Newton optimizers
OPTPP::NLF2 * nlf2Con
 pointer to constraint NLF for full Newton optimizers
OPTPP::OptimizeClass * theOptimizer
 optimizer base class pointer
OPTPP::OptPDS * optpds
 PDS optimizer pointer.
OPTPP::OptCG * optcg
 CG optimizer pointer.
OPTPP::OptLBFGS * optlbfgs
 L-BFGS optimizer pointer.
OPTPP::OptNewton * optnewton
 Newton optimizer pointer.
OPTPP::OptQNewton * optqnewton
 Quasi-Newton optimizer pointer.
OPTPP::OptFDNewton * optfdnewton
 Finite Difference Newton opt pointer.
OPTPP::OptBCNewton * optbcnewton
 Bound constrained Newton opt pointer.
OPTPP::OptBCQNewton * optbcqnewton
 Bnd constrained Quasi-Newton opt ptr.
OPTPP::OptBCFDNewton * optbcfdnewton
 Bnd constrained FD-Newton opt ptr.
OPTPP::OptNIPS * optnips
 NIPS optimizer pointer.
OPTPP::OptQNIPS * optqnips
 Quasi-Newton NIPS optimizer pointer.
OPTPP::OptFDNIPS * optfdnips
 Finite Difference NIPS opt pointer.
String setUpType
 flag for iteration mode: "model" (normal usage) or "user_functions" (user-supplied functions mode for "on the fly" instantiations). NonDReliability currently uses the user_functions mode.
RealVector initialPoint
 holds initial point passed in for "user_functions" mode.
RealVector lowerBounds
 holds variable lower bounds passed in for "user_functions" mode.
RealVector upperBounds
 holds variable upper bounds passed in for "user_functions" mode.

Static Private Attributes

static SNLLOptimizersnllOptInstance
 pointer to the active object instance used within the static evaluator functions in order to avoid the need for static data

Detailed Description

Wrapper class for the OPT++ optimization library.

The SNLLOptimizer class provides a wrapper for OPT++, a C++ optimization library of nonlinear programming and pattern search techniques from the Computational Sciences and Mathematics Research (CSMR) department at Sandia's Livermore CA site. It uses a function pointer approach for which passed functions must be either global functions or static member functions. Any attribute used within static member functions must be either local to that function, a static member, or accessed by static pointer.

The user input mappings are as follows: max_iterations, max_function_evaluations, convergence_tolerance, max_step, gradient_tolerance, search_method, and search_scheme_size are set using OPT++'s setMaxIter(), setMaxFeval(), setFcnTol(), setMaxStep(), setGradTol(), setSearchStrategy(), and setSSS() member functions, respectively; output verbosity is used to toggle OPT++'s debug mode using the setDebug() member function. Internal to OPT++, there are 3 search strategies, while the DAKOTA search_method specification supports 4 (value_based_line_search, gradient_based_line_search, trust_region, or tr_pds). The difference stems from the "is_expensive" flag in OPT++. If the search strategy is LineSearch and "is_expensive" is turned on, then the value_based_line_search is used. Otherwise (the "is_expensive" default is off), the algorithm will use the gradient_based_line_search. Refer to [Meza, J.C., 1994] and to the OPT++ source in the Dakota/packages/OPTPP directory for information on OPT++ class member functions.


Constructor & Destructor Documentation

SNLLOptimizer ( Model model)

standard constructor

This constructor is used for normal instantiations using data from the ProblemDescDB.

References Dakota::abort_handler(), Minimizer::boundConstraintFlag, SNLLOptimizer::constraint0_evaluator(), SNLLOptimizer::constraint1_evaluator(), SNLLOptimizer::constraint2_evaluator(), Iterator::convergenceTol, Iterator::fdGradStepSize, SNLLOptimizer::fdnlf1, SNLLOptimizer::fdnlf1Con, ProblemDescDB::get_int(), ProblemDescDB::get_real(), ProblemDescDB::get_string(), Model::init_communicators(), SNLLBase::init_fn(), Iterator::intervalType, Iterator::iteratedModel, Dakota::LARGE_SCALE, Iterator::maxConcurrency, Iterator::maxFunctionEvals, Iterator::maxIterations, SNLLBase::meritFn, Iterator::methodName, Optimizer::multiObjFlag, SNLLOptimizer::nlf0, SNLLOptimizer::nlf0_evaluator(), SNLLOptimizer::nlf1, SNLLOptimizer::nlf1_evaluator(), SNLLOptimizer::nlf1Con, SNLLOptimizer::nlf2, SNLLOptimizer::nlf2_evaluator(), SNLLOptimizer::nlf2Con, SNLLOptimizer::nlfConstraint, SNLLOptimizer::nlfObjective, SNLLOptimizer::nlpConstraint, Minimizer::numConstraints, Iterator::numContinuousVars, Minimizer::numNonlinearConstraints, SNLLOptimizer::optbcfdnewton, SNLLOptimizer::optbcnewton, SNLLOptimizer::optbcqnewton, SNLLOptimizer::optcg, SNLLOptimizer::optfdnewton, SNLLOptimizer::optfdnips, SNLLOptimizer::optlbfgs, SNLLOptimizer::optnewton, SNLLOptimizer::optnips, SNLLOptimizer::optpds, SNLLOptimizer::optqnewton, SNLLOptimizer::optqnips, Iterator::outputLevel, Iterator::probDescDB, Minimizer::scaleFlag, SNLLBase::searchStrat, SNLLBase::snll_post_instantiate(), SNLLBase::snll_pre_instantiate(), SNLLOptimizer::theOptimizer, and Minimizer::vendorNumericalGradFlag.

SNLLOptimizer ( const String method_name,
Model model 
)
SNLLOptimizer ( const RealVector &  initial_pt,
const RealVector &  var_l_bnds,
const RealVector &  var_u_bnds,
const RealMatrix &  lin_ineq_coeffs,
const RealVector &  lin_ineq_l_bnds,
const RealVector &  lin_ineq_u_bnds,
const RealMatrix &  lin_eq_coeffs,
const RealVector &  lin_eq_tgts,
const RealVector &  nln_ineq_l_bnds,
const RealVector &  nln_ineq_u_bnds,
const RealVector &  nln_eq_tgts,
void(*)(int mode, int n, const NEWMAT::ColumnVector &x, NEWMAT::Real &f, NEWMAT::ColumnVector &grad_f, int &result_mode)  user_obj_eval,
void(*)(int mode, int n, const NEWMAT::ColumnVector &x, NEWMAT::ColumnVector &g, NEWMAT::Matrix &grad_g, int &result_mode)  user_con_eval 
)

Member Function Documentation

void nlf0_evaluator ( int  n,
const NEWMAT::ColumnVector &  x,
NEWMAT::Real &  f,
int &  result_mode 
) [static, private]

objective function evaluator function for OPT++ methods which require only function values.

For use when DAKOTA computes f and gradients are not directly available. This is used by nongradient-based optimizers such as PDS and by gradient-based optimizers in vendor numerical gradient mode (opt++'s internal finite difference routine is used).

References Model::compute_response(), Model::continuous_variables(), Dakota::copy_data(), Model::current_response(), Response::function_values(), Iterator::iteratedModel, SNLLBase::lastEvalVars, SNLLBase::lastFnEvalLocn, Minimizer::numNonlinearConstraints, Iterator::outputLevel, and SNLLOptimizer::snllOptInstance.

Referenced by SNLLOptimizer::SNLLOptimizer().

void nlf1_evaluator ( int  mode,
int  n,
const NEWMAT::ColumnVector &  x,
NEWMAT::Real &  f,
NEWMAT::ColumnVector &  grad_f,
int &  result_mode 
) [static, private]

objective function evaluator function which provides function values and gradients to OPT++ methods.

For use when DAKOTA computes f and df/dX (regardless of gradientType). Vendor numerical gradient case is handled by nlf0_evaluator.

References Iterator::activeSet, Model::compute_response(), Model::continuous_variables(), Dakota::copy_data(), Model::current_response(), Response::function_gradients(), Response::function_values(), Iterator::iteratedModel, SNLLBase::lastEvalMode, SNLLBase::lastEvalVars, SNLLBase::lastFnEvalLocn, Minimizer::numNonlinearConstraints, Iterator::outputLevel, ActiveSet::request_values(), and SNLLOptimizer::snllOptInstance.

Referenced by SNLLOptimizer::SNLLOptimizer().

void nlf2_evaluator ( int  mode,
int  n,
const NEWMAT::ColumnVector &  x,
NEWMAT::Real &  f,
NEWMAT::ColumnVector &  grad_f,
NEWMAT::SymmetricMatrix &  hess_f,
int &  result_mode 
) [static, private]

objective function evaluator function which provides function values, gradients, and Hessians to OPT++ methods.

For use when DAKOTA receives f, df/dX, & d^2f/dx^2 from the ApplicationInterface (analytic only). Finite differencing does not make sense for a full Newton approach, since lack of analytic gradients & Hessian should dictate the use of quasi-newton or fd-newton. Thus, there is no fdnlf2_evaluator for use with full Newton approaches, since it is preferable to use quasi-newton or fd-newton with nlf1. Gauss-Newton does not fit this model; it uses nlf2_evaluator_gn instead of nlf2_evaluator.

References Iterator::activeSet, Model::compute_response(), Model::continuous_variables(), Dakota::copy_data(), Model::current_response(), Response::function_gradients(), Response::function_hessians(), Response::function_values(), Iterator::iteratedModel, SNLLBase::lastEvalMode, SNLLBase::lastEvalVars, SNLLBase::lastFnEvalLocn, Minimizer::numNonlinearConstraints, Iterator::outputLevel, ActiveSet::request_values(), and SNLLOptimizer::snllOptInstance.

Referenced by SNLLOptimizer::SNLLOptimizer().

void constraint0_evaluator ( int  n,
const NEWMAT::ColumnVector &  x,
NEWMAT::ColumnVector &  g,
int &  result_mode 
) [static, private]

constraint evaluator function for OPT++ methods which require only constraint values.

For use when DAKOTA computes g and gradients are not directly available. This is used by nongradient-based optimizers and by gradient-based optimizers in vendor numerical gradient mode (opt++'s internal finite difference routine is used).

References Model::compute_response(), Model::continuous_variables(), SNLLBase::copy_con_vals(), Dakota::copy_data(), Model::current_response(), Response::function_values(), Iterator::iteratedModel, SNLLBase::lastEvalVars, SNLLBase::lastFnEvalLocn, Optimizer::numObjectiveFns, Iterator::outputLevel, and SNLLOptimizer::snllOptInstance.

Referenced by SNLLOptimizer::SNLLOptimizer().

void constraint1_evaluator ( int  mode,
int  n,
const NEWMAT::ColumnVector &  x,
NEWMAT::ColumnVector &  g,
NEWMAT::Matrix &  grad_g,
int &  result_mode 
) [static, private]

constraint evaluator function which provides constraint values and gradients to OPT++ methods.

For use when DAKOTA computes g and dg/dX (regardless of gradientType). Vendor numerical gradient case is handled by constraint0_evaluator.

References Iterator::activeSet, Model::compute_response(), Model::continuous_variables(), SNLLBase::copy_con_grad(), SNLLBase::copy_con_vals(), Dakota::copy_data(), Model::current_response(), Response::function_gradients(), Response::function_values(), Iterator::iteratedModel, SNLLBase::lastEvalMode, SNLLBase::lastEvalVars, SNLLBase::lastFnEvalLocn, Optimizer::numObjectiveFns, Iterator::outputLevel, ActiveSet::request_values(), and SNLLOptimizer::snllOptInstance.

Referenced by SNLLOptimizer::SNLLOptimizer().

void constraint2_evaluator ( int  mode,
int  n,
const NEWMAT::ColumnVector &  x,
NEWMAT::ColumnVector &  g,
NEWMAT::Matrix &  grad_g,
OPTPP::OptppArray< NEWMAT::SymmetricMatrix > &  hess_g,
int &  result_mode 
) [static, private]

The documentation for this class was generated from the following files: