Wrapper class for the OPT++ optimization library. More...
Public Member Functions | |
SNLLLeastSq (Model &model) | |
standard constructor | |
SNLLLeastSq (const String &method_name, Model &model) | |
alternate constructor for instantiations without ProblemDescDB support | |
~SNLLLeastSq () | |
destructor | |
void | minimize_residuals () |
Performs the iterations to determine the least squares solution. | |
Protected Member Functions | |
void | initialize_run () |
invokes LeastSq::initialize_run(), SNLLBase::snll_initialize_run(), and performs other set-up | |
void | post_run (std::ostream &s) |
invokes snll_post_run and re-implements post_run (does not call parent) and performs other solution processing | |
void | finalize_run () |
restores instances | |
Static Private Member Functions | |
static void | nlf2_evaluator_gn (int mode, int n, const RealVector &x, double &f, RealVector &grad_f, RealSymMatrix &hess_f, int &result_mode) |
objective function evaluator function which obtains values and gradients for least square terms and computes objective function value, gradient, and Hessian using the Gauss-Newton approximation. | |
static void | constraint1_evaluator_gn (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++ Gauss-Newton methods. | |
static void | constraint2_evaluator_gn (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++ Gauss-Newton methods. | |
Private Attributes | |
SNLLLeastSq * | prevSnllLSqInstance |
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::NLF2 * | nlf2 |
pointer to objective NLF for full Newton optimizers | |
OPTPP::NLF2 * | nlf2Con |
pointer to constraint NLF for full Newton optimizers | |
OPTPP::NLF1 * | nlf1Con |
pointer to constraint NLF for Quasi Newton optimizers | |
OPTPP::OptimizeClass * | theOptimizer |
optimizer base class pointer | |
OPTPP::OptNewton * | optnewton |
Newton optimizer pointer. | |
OPTPP::OptBCNewton * | optbcnewton |
Bound constrained Newton optimizer ptr. | |
OPTPP::OptDHNIPS * | optdhnips |
Disaggregated Hessian NIPS optimizer ptr. | |
Static Private Attributes | |
static SNLLLeastSq * | snllLSqInstance |
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 SNLLLeastSq 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.
void post_run | ( | std::ostream & | s | ) | [protected, virtual] |
invokes snll_post_run and re-implements post_run (does not call parent) and performs other solution processing
SNLLLeastSq requires fn DB lookup, so overrides LeastSq::post_run and directly invokes Iterator::post_run when complete.
Reimplemented from LeastSq.
References Iterator::activeSet, Iterator::bestResponseArray, Iterator::bestVariablesArray, SNLLBase::copy_con_vals_optpp_to_dak(), Dakota::copy_data_partial(), Minimizer::cvScaleMultipliers, Minimizer::cvScaleOffsets, Minimizer::cvScaleTypes, Dakota::data_pairs, Response::function_values(), LeastSq::get_confidence_intervals(), Model::interface_id(), Iterator::iteratedModel, Dakota::lookup_by_val(), Minimizer::modify_s2n(), SNLLLeastSq::nlfObjective, Iterator::numFunctions, LeastSq::numLeastSqTerms, Minimizer::numNonlinearConstraints, ActiveSet::request_values(), ActiveSet::request_vector(), Minimizer::responseScaleMultipliers, Minimizer::responseScaleOffsets, Minimizer::responseScaleTypes, Minimizer::secondaryRespScaleFlag, SNLLBase::snll_post_run(), SNLLLeastSq::theOptimizer, and Minimizer::varsScaleFlag.
void nlf2_evaluator_gn | ( | 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 obtains values and gradients for least square terms and computes objective function value, gradient, and Hessian using the Gauss-Newton approximation.
This nlf2 evaluator function is used for the Gauss-Newton method in order to exploit the special structure of the nonlinear least squares problem. Here, fx = sum (T_i - Tbar_i)^2 and Response is made up of residual functions and their gradients along with any nonlinear constraints. The objective function and its gradient vector and Hessian matrix are computed directly from the residual functions and their derivatives (which are returned from the Response object).
References Dakota::abort_handler(), Iterator::activeSet, Model::compute_response(), Model::continuous_variables(), Model::current_response(), Response::function_gradients(), Response::function_values(), Iterator::iteratedModel, SNLLBase::lastEvalMode, SNLLBase::lastEvalVars, SNLLBase::lastFnEvalLocn, Iterator::numFunctions, LeastSq::numLeastSqTerms, Minimizer::numNonlinearConstraints, Iterator::outputLevel, ActiveSet::request_vector(), SNLLLeastSq::snllLSqInstance, Dakota::write_data(), and Dakota::write_precision.
Referenced by SNLLLeastSq::SNLLLeastSq().
void constraint1_evaluator_gn | ( | 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++ Gauss-Newton methods.
While it does not employ the Gauss-Newton approximation, it is distinct from constraint1_evaluator() due to its need to anticipate the required modes for the least squares terms. This constraint evaluator function is used with diaggregated Hessian NIPS and is currently active.
References Dakota::abort_handler(), 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, Iterator::numFunctions, LeastSq::numLeastSqTerms, Iterator::outputLevel, ActiveSet::request_vector(), and SNLLLeastSq::snllLSqInstance.
Referenced by SNLLLeastSq::SNLLLeastSq().
void constraint2_evaluator_gn | ( | 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++ Gauss-Newton methods.
While it does not employ the Gauss-Newton approximation, it is distinct from constraint2_evaluator() due to its need to anticipate the required modes for the least squares terms. This constraint evaluator function is used with full Newton NIPS and is currently inactive.
References Dakota::abort_handler(), 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, SNLLBase::modeOverrideFlag, Iterator::numFunctions, LeastSq::numLeastSqTerms, Iterator::outputLevel, ActiveSet::request_vector(), and SNLLLeastSq::snllLSqInstance.