Wrapper class for the OPT++ optimization library. More...
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 RealVector &x, double &f, RealVector &grad_f, int &result_mode), void(*user_con_eval)(int mode, int n, const RealVector &x, RealVector &g, RealMatrix &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 RealVector &x, double &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 RealVector &x, double &f, RealVector &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 RealVector &x, double &f, RealVector &grad_f, RealSymMatrix &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 RealVector &x, RealVector &g, int &result_mode) |
constraint evaluator function for OPT++ methods which require only constraint values. | |
static void | constraint1_evaluator (int mode, int n, const RealVector &x, RealVector &g, RealMatrix &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 RealVector &x, RealVector &g, RealMatrix &grad_g, OPTPP::OptppArray< RealSymMatrix > &hess_g, int &result_mode) |
constraint evaluator function which provides constraint values, gradients, and Hessians to OPT++ methods. | |
Private Attributes | |
SNLLOptimizer * | prevSnllOptInstance |
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 SNLLOptimizer * | snllOptInstance |
pointer to the active object instance used within the static evaluator functions in order to avoid the need for static data |
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.
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, Optimizer::localObjectiveRecast, Iterator::maxConcurrency, Iterator::maxFunctionEvals, Iterator::maxIterations, SNLLBase::meritFn, Iterator::methodName, 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 | ||
) |
alternate constructor for instantiations "on the fly"
This is an alternate constructor for instantiations on the fly using a Model but no ProblemDescDB.
References Minimizer::boundConstraintFlag, SNLLOptimizer::constraint1_evaluator(), Iterator::convergenceTol, Iterator::fdGradStepSize, SNLLBase::init_fn(), Iterator::intervalType, Dakota::LARGE_SCALE, Iterator::maxFunctionEvals, Iterator::maxIterations, SNLLBase::meritFn, Iterator::method_name(), Iterator::methodName, SNLLOptimizer::nlf1, SNLLOptimizer::nlf1_evaluator(), SNLLOptimizer::nlf1Con, SNLLOptimizer::nlfConstraint, SNLLOptimizer::nlfObjective, SNLLOptimizer::nlpConstraint, Minimizer::numConstraints, Iterator::numContinuousVars, Minimizer::numNonlinearConstraints, SNLLOptimizer::optbcqnewton, SNLLOptimizer::optlbfgs, SNLLOptimizer::optqnewton, SNLLOptimizer::optqnips, Iterator::outputLevel, SNLLBase::searchStrat, SNLLBase::snll_post_instantiate(), SNLLBase::snll_pre_instantiate(), SNLLOptimizer::theOptimizer, and Minimizer::vendorNumericalGradFlag.
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 RealVector &x, double &f, RealVector &grad_f, int &result_mode) | user_obj_eval, | ||
void(*)(int mode, int n, const RealVector &x, RealVector &g, RealMatrix &grad_g, int &result_mode) | user_con_eval | ||
) |
alternate constructor for instantiations "on the fly"
This is an alternate constructor for performing an optimization using the passed in objective function and constraint function pointers.
References Minimizer::bigRealBoundSize, Minimizer::boundConstraintFlag, SNLLBase::init_fn(), SNLLOptimizer::initialPoint, Dakota::LARGE_SCALE, SNLLOptimizer::lowerBounds, SNLLBase::meritFn, SNLLOptimizer::nlf1, SNLLOptimizer::nlf1Con, SNLLOptimizer::nlfConstraint, SNLLOptimizer::nlfObjective, SNLLOptimizer::nlpConstraint, Minimizer::numConstraints, Iterator::numContinuousVars, Minimizer::numNonlinearConstraints, SNLLOptimizer::optbcqnewton, SNLLOptimizer::optlbfgs, SNLLOptimizer::optqnewton, SNLLOptimizer::optqnips, Iterator::outputLevel, SNLLBase::searchStrat, SNLLBase::snll_initialize_run(), SNLLBase::snll_post_instantiate(), SNLLBase::snll_pre_instantiate(), SNLLOptimizer::theOptimizer, and SNLLOptimizer::upperBounds.
void nlf0_evaluator | ( | int | n, |
const RealVector & | x, | ||
double & | 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(), Model::current_response(), Response::function_value(), 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 RealVector & | x, | ||
double & | f, | ||
RealVector & | 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(), Model::current_response(), Response::function_gradient_copy(), Response::function_value(), 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 RealVector & | x, | ||
double & | f, | ||
RealVector & | grad_f, | ||
RealSymMatrix & | 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(), Model::current_response(), Response::function_gradient_copy(), Response::function_hessian(), Response::function_value(), 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 RealVector & | x, | ||
RealVector & | 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_dak_to_optpp(), 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 RealVector & | x, | ||
RealVector & | g, | ||
RealMatrix & | 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_dak_to_optpp(), 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 RealVector & | x, | ||
RealVector & | g, | ||
RealMatrix & | grad_g, | ||
OPTPP::OptppArray< RealSymMatrix > & | hess_g, | ||
int & | result_mode | ||
) | [static, private] |
constraint evaluator function which provides constraint values, gradients, and Hessians to OPT++ methods.
For use when DAKOTA computes g, dg/dX, & d^2g/dx^2 (analytic only).
References Iterator::activeSet, Model::compute_response(), Model::continuous_variables(), SNLLBase::copy_con_grad(), SNLLBase::copy_con_hess(), SNLLBase::copy_con_vals_dak_to_optpp(), Model::current_response(), Response::function_gradients(), Response::function_hessians(), 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().