![]() |
Dakota
Version 6.15
Explore and Predict with Confidence
|
Wrapper class for the NLSSOL nonlinear least squares library. More...
Public Member Functions | |
NLSSOLLeastSq (ProblemDescDB &problem_db, Model &model) | |
standard constructor More... | |
NLSSOLLeastSq (Model &model) | |
alternate constructor More... | |
~NLSSOLLeastSq () | |
destructor | |
void | core_run () |
core portion of run; implemented by all derived classes and may include pre/post steps in lieu of separate pre/post More... | |
![]() | |
SOLBase () | |
default constructor | |
SOLBase (Model &model) | |
standard constructor | |
~SOLBase () | |
destructor | |
Protected Member Functions | |
void | send_sol_option (std::string sol_option) override |
Resize and send option to NPSOL (npoptn) or NLSSOL (nloptn) via derived implementation. | |
![]() | |
LeastSq (std::shared_ptr< TraitsBase > traits) | |
default constructor | |
LeastSq (ProblemDescDB &problem_db, Model &model, std::shared_ptr< TraitsBase > traits) | |
standard constructor More... | |
LeastSq (unsigned short method_name, Model &model, std::shared_ptr< TraitsBase > traits) | |
alternate "on the fly" constructor | |
~LeastSq () | |
destructor | |
void | initialize_run () |
void | post_run (std::ostream &s) |
void | finalize_run () |
utility function to perform common operations following post_run(); deallocation and resetting of instance pointers More... | |
void | print_results (std::ostream &s, short results_state=FINAL_RESULTS) |
void | get_confidence_intervals (const Variables &native_vars, const Response &iter_resp) |
Calculate confidence intervals on estimated parameters. More... | |
![]() | |
Minimizer (std::shared_ptr< TraitsBase > traits=std::shared_ptr< TraitsBase >(new TraitsBase())) | |
default constructor | |
Minimizer (ProblemDescDB &problem_db, Model &model, std::shared_ptr< TraitsBase > traits=std::shared_ptr< TraitsBase >(new TraitsBase())) | |
standard constructor More... | |
Minimizer (unsigned short method_name, Model &model, std::shared_ptr< TraitsBase > traits=std::shared_ptr< TraitsBase >(new TraitsBase())) | |
alternate constructor for "on the fly" instantiations | |
Minimizer (unsigned short method_name, size_t num_lin_ineq, size_t num_lin_eq, size_t num_nln_ineq, size_t num_nln_eq, std::shared_ptr< TraitsBase > traits=std::shared_ptr< TraitsBase >(new TraitsBase())) | |
alternate constructor for "on the fly" instantiations | |
~Minimizer () | |
destructor | |
void | update_from_model (const Model &model) |
set inherited data attributes based on extractions from incoming model | |
void | initialize_run () |
utility function to perform common operations prior to pre_run(); typically memory initialization; setting of instance pointers More... | |
void | post_run (std::ostream &s) |
post-run portion of run (optional); verbose to print results; re-implemented by Iterators that can read all Variables/Responses and perform final analysis phase in a standalone way More... | |
void | finalize_run () |
utility function to perform common operations following post_run(); deallocation and resetting of instance pointers More... | |
const Model & | algorithm_space_model () const |
Model | original_model (unsigned short recasts_left=0) const |
Return a shallow copy of the original model this Iterator was originally passed, optionally leaving recasts_left on top of it. | |
void | data_transform_model () |
Wrap iteratedModel in a RecastModel that subtracts provided observed data from the primary response functions (variables and secondary responses are unchanged) More... | |
void | scale_model () |
Wrap iteratedModel in a RecastModel that performs variable and/or response scaling. More... | |
Real | objective (const RealVector &fn_vals, const BoolDeque &max_sense, const RealVector &primary_wts) const |
compute a composite objective value from one or more primary functions More... | |
Real | objective (const RealVector &fn_vals, size_t num_fns, const BoolDeque &max_sense, const RealVector &primary_wts) const |
compute a composite objective with specified number of source primary functions, instead of userPrimaryFns More... | |
void | objective_gradient (const RealVector &fn_vals, const RealMatrix &fn_grads, const BoolDeque &max_sense, const RealVector &primary_wts, RealVector &obj_grad) const |
compute the gradient of the composite objective function | |
void | objective_gradient (const RealVector &fn_vals, size_t num_fns, const RealMatrix &fn_grads, const BoolDeque &max_sense, const RealVector &primary_wts, RealVector &obj_grad) const |
compute the gradient of the composite objective function More... | |
void | objective_hessian (const RealVector &fn_vals, const RealMatrix &fn_grads, const RealSymMatrixArray &fn_hessians, const BoolDeque &max_sense, const RealVector &primary_wts, RealSymMatrix &obj_hess) const |
compute the Hessian of the composite objective function | |
void | objective_hessian (const RealVector &fn_vals, size_t num_fns, const RealMatrix &fn_grads, const RealSymMatrixArray &fn_hessians, const BoolDeque &max_sense, const RealVector &primary_wts, RealSymMatrix &obj_hess) const |
compute the Hessian of the composite objective function More... | |
void | archive_best_variables (const bool active_only=false) const |
archive best variables for the index'th final solution | |
void | archive_best_objective_functions () const |
archive the index'th set of objective functions | |
void | archive_best_constraints () const |
archive the index'th set of constraints | |
void | archive_best_residuals () const |
Archive residuals when calibration terms are used. | |
void | resize_best_vars_array (size_t newsize) |
Safely resize the best variables array to newsize taking into account the envelope-letter design pattern and any recasting. More... | |
void | resize_best_resp_array (size_t newsize) |
Safely resize the best response array to newsize taking into account the envelope-letter design pattern and any recasting. More... | |
void | local_recast_retrieve (const Variables &vars, Response &response) const |
infers MOO/NLS solution from the solution of a single-objective optimizer More... | |
![]() | |
Iterator (BaseConstructor, ProblemDescDB &problem_db, std::shared_ptr< TraitsBase > traits=std::shared_ptr< TraitsBase >(new TraitsBase())) | |
constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139) More... | |
Iterator (NoDBBaseConstructor, unsigned short method_name, Model &model, std::shared_ptr< TraitsBase > traits=std::shared_ptr< TraitsBase >(new TraitsBase())) | |
alternate constructor for base iterator classes constructed on the fly More... | |
Iterator (NoDBBaseConstructor, unsigned short method_name, std::shared_ptr< TraitsBase > traits=std::shared_ptr< TraitsBase >(new TraitsBase())) | |
alternate constructor for base iterator classes constructed on the fly More... | |
virtual void | derived_init_communicators (ParLevLIter pl_iter) |
derived class contributions to initializing the communicators associated with this Iterator instance | |
virtual const VariablesArray & | initial_points () const |
gets the multiple initial points for this iterator. This will only be meaningful after a call to initial_points mutator. | |
StrStrSizet | run_identifier () const |
get the unique run identifier based on method name, id, and number of executions | |
void | initialize_model_graphics (Model &model, int iterator_server_id) |
helper function that encapsulates initialization operations, modular on incoming Model instance More... | |
void | export_final_surrogates (Model &data_fit_surr_model) |
export final surrogates generated, e.g., GP in EGO and friends More... | |
![]() | |
void | allocate_linear_arrays (int num_cv, const RealMatrix &lin_ineq_coeffs, const RealMatrix &lin_eq_coeffs) |
Allocates F77 linear constraint arrays for the SOL algorithms. | |
void | allocate_nonlinear_arrays (int num_cv, size_t num_nln_con) |
Allocates F77 nonlinear constraint arrays for the SOL algorithms. | |
void | size_bounds_array (size_t new_bnds_size) |
Updates arrays dependent on combined bounds size. | |
void | allocate_arrays (int num_cv, size_t num_nln_con, const RealMatrix &lin_ineq_coeffs, const RealMatrix &lin_eq_coeffs) |
Allocates F77 arrays for the SOL algorithms. | |
void | replace_linear_arrays (size_t num_cv, size_t num_nln_con, const RealMatrix &lin_ineq_coeffs, const RealMatrix &lin_eq_coeffs) |
update linear constraint arrays | |
void | replace_nonlinear_arrays (int num_cv, size_t num_lin_con, size_t num_nln_con) |
update nonlinear constraint arrays | |
void | deallocate_arrays () |
Deallocates memory previously allocated by allocate_arrays(). | |
void | allocate_workspace (int num_cv, int num_nln_con, int num_lin_con, int num_lsq) |
Allocates real and integer workspaces for the SOL algorithms. | |
void | set_options (bool speculative_flag, bool vendor_num_grad_flag, short output_lev, int verify_lev, Real fn_prec, Real linesrch_tol, size_t max_iter, Real constr_tol, Real conv_tol, const std::string &grad_type, const RealVector &fdss) |
Sets SOL method options using calls to npoptn2 / nloptn2. | |
void | augment_bounds (RealVector &aggregate_l_bnds, RealVector &aggregate_u_bnds, const Model &model) |
augments variable bounds with linear and nonlinear constraint bounds. | |
void | augment_bounds (RealVector &aggregate_l_bnds, RealVector &aggregate_u_bnds, const RealVector &lin_ineq_l_bnds, const RealVector &lin_ineq_u_bnds, const RealVector &lin_eq_targets, const RealVector &nln_ineq_l_bnds, const RealVector &nln_ineq_u_bnds, const RealVector &nln_eq_targets) |
augments variable bounds with linear and nonlinear constraint bounds. | |
void | replace_variable_bounds (size_t num_lin_con, size_t num_nln_con, RealVector &aggregate_l_bnds, RealVector &aggregate_u_bnds, const RealVector &cv_lower_bnds, const RealVector &cv_upper_bnds) |
replace variable bounds within aggregate arrays | |
void | replace_linear_bounds (size_t num_cv, size_t num_nln_con, RealVector &aggregate_l_bnds, RealVector &aggregate_u_bnds, const RealVector &lin_ineq_l_bnds, const RealVector &lin_ineq_u_bnds, const RealVector &lin_eq_targets) |
replace linear bounds within aggregate arrays | |
void | replace_nonlinear_bounds (size_t num_cv, size_t num_lin_con, RealVector &aggregate_l_bnds, RealVector &aggregate_u_bnds, const RealVector &nln_ineq_l_bnds, const RealVector &nln_ineq_u_bnds, const RealVector &nln_eq_targets) |
replace nonlinear bounds within aggregate arrays | |
Static Private Member Functions | |
static void | least_sq_eval (int &mode, int &m, int &n, int &nrowfj, double *x, double *f, double *gradf, int &nstate) |
Evaluator for NLSSOL: computes the values and first derivatives of the least squares terms (passed by function pointer to NLSSOL). | |
Static Private Attributes | |
static NLSSOLLeastSq * | nlssolInstance |
pointer to the active object instance used within the static evaluator functions in order to avoid the need for static data | |
Additional Inherited Members | |
![]() | |
static Real | sum_squared_residuals (size_t num_pri_fns, const RealVector &residuals, const RealVector &weights) |
return weighted sum of squared residuals | |
static void | print_residuals (size_t num_terms, const RealVector &best_terms, const RealVector &weights, size_t num_best, size_t best_index, std::ostream &s) |
print num_terms residuals and misfit for final results | |
static void | print_model_resp (size_t num_pri_fns, const RealVector &best_fns, size_t num_best, size_t best_index, std::ostream &s) |
print the original user model resp in the case of data transformations | |
![]() | |
static void | gnewton_set_recast (const Variables &recast_vars, const ActiveSet &recast_set, ActiveSet &sub_model_set) |
conversion of request vector values for the Gauss-Newton Hessian approximation More... | |
![]() | |
static void | constraint_eval (int &mode, int &ncnln, int &n, int &nrowj, int *needc, double *x, double *c, double *cjac, int &nstate) |
CONFUN in NPSOL manual: computes the values and first derivatives of the nonlinear constraint functions. | |
![]() | |
size_t | numLeastSqTerms |
number of least squares terms | |
LeastSq * | prevLSqInstance |
pointer containing previous value of leastSqInstance | |
bool | weightFlag |
flag indicating whether weighted least squares is active | |
RealVector | confBoundsLower |
lower bounds for confidence intervals on calibration parameters | |
RealVector | confBoundsUpper |
upper bounds for confidence intervals on calibration parameters | |
RealVector | bestIterPriFns |
storage for iterator best primary functions (which shouldn't be stored in bestResponseArray when there are transformations) | |
bool | retrievedIterPriFns |
whether final primary iterator space functions have been retrieved (possibly by a derived class) | |
![]() | |
int | realWorkSpaceSize |
size of realWorkSpace | |
int | intWorkSpaceSize |
size of intWorkSpace | |
RealArray | realWorkSpace |
real work space for NPSOL/NLSSOL | |
IntArray | intWorkSpace |
int work space for NPSOL/NLSSOL | |
int | nlnConstraintArraySize |
used for non-zero array sizing (nonlinear constraints) | |
int | linConstraintArraySize |
used for non-zero array sizing (linear constraints) | |
RealArray | cLambda |
CLAMBDA from NPSOL manual: Langrange multipliers. | |
IntArray | constraintState |
ISTATE from NPSOL manual: constraint status. | |
int | informResult |
INFORM from NPSOL manual: optimization status on exit. | |
int | numberIterations |
ITER from NPSOL manual: number of (major) iterations performed. | |
int | boundsArraySize |
length of aggregated bounds arrays (variable bounds plus linear and nonlinear constraint bounds) | |
double * | linConstraintMatrixF77 |
[A] matrix from NPSOL manual: linear constraint coefficients | |
double * | upperFactorHessianF77 |
[R] matrix from NPSOL manual: upper Cholesky factor of the Hessian of the Lagrangian. | |
double * | constraintJacMatrixF77 |
[CJAC] matrix from NPSOL manual: nonlinear constraint Jacobian | |
int | fnEvalCntr |
counter for testing against maxFunctionEvals | |
size_t | constrOffset |
used in constraint_eval() to bridge NLSSOLLeastSq::numLeastSqTerms and NPSOLOptimizer::numObjectiveFns | |
![]() | |
static LeastSq * | leastSqInstance |
pointer to LeastSq instance used in static member functions | |
![]() | |
static SOLBase * | solInstance |
pointer to the active object instance used within the static evaluator functions in order to avoid the need for static data | |
static Minimizer * | optLSqInstance |
pointer to the active base class object instance used within the static evaluator functions in order to avoid the need for static data | |
Wrapper class for the NLSSOL nonlinear least squares library.
The NLSSOLLeastSq class provides a wrapper for NLSSOL, a Fortran 77 sequential quadratic programming library from Stanford University marketed by Stanford Business Associates. It uses a function pointer approach for which passed functions must be either global functions or static member functions. Any nonstatic attribute used within static member functions must be either local to that function or accessed through a static pointer.
The user input mappings are as follows: max_function_evaluations
is implemented directly in NLSSOLLeastSq's evaluator functions since there is no NLSSOL parameter equivalent, and max_iterations
, convergence_tolerance
, output
verbosity, verify_level
, function_precision
, and linesearch_tolerance
are mapped into NLSSOL's "Major Iteration Limit", "Optimality Tolerance", "Major
Print Level" (verbose:
Major Print Level = 20; quiet:
Major Print Level = 10), "Verify Level", "Function Precision", and "Linesearch Tolerance" parameters, respectively, using NLSSOL's nloptn() subroutine (as wrapped by nloptn2() from the sol_optn_wrapper.f file). Refer to [Gill, P.E., Murray, W., Saunders, M.A., and Wright, M.H., 1986] for information on NLSSOL's optional input parameters and the nloptn() subroutine.
NLSSOLLeastSq | ( | ProblemDescDB & | problem_db, |
Model & | model | ||
) |
standard constructor
This is the primary constructor. It accepts a Model reference.
References Minimizer::constraintTol, Iterator::convergenceTol, Model::fd_gradient_step_size(), ProblemDescDB::get_int(), ProblemDescDB::get_real(), Model::gradient_type(), Iterator::iteratedModel, Iterator::maxIterations, Iterator::outputLevel, Iterator::probDescDB, SOLBase::set_options(), Minimizer::speculativeFlag, and Minimizer::vendorNumericalGradFlag.
NLSSOLLeastSq | ( | Model & | model) |
alternate constructor
This is an alternate constructor which accepts a Model but does not have a supporting method specification from the ProblemDescDB.
References Minimizer::constraintTol, Iterator::convergenceTol, Model::fd_gradient_step_size(), Model::gradient_type(), Iterator::iteratedModel, Iterator::maxIterations, Iterator::outputLevel, SOLBase::set_options(), Minimizer::speculativeFlag, and Minimizer::vendorNumericalGradFlag.
|
virtual |
core portion of run; implemented by all derived classes and may include pre/post steps in lieu of separate pre/post
Virtual run function for the iterator class hierarchy. All derived classes need to redefine it.
Reimplemented from Iterator.
References SOLBase::allocate_arrays(), SOLBase::allocate_workspace(), SOLBase::augment_bounds(), LeastSq::bestIterPriFns, Iterator::bestResponseArray, Iterator::bestVariablesArray, SOLBase::cLambda, SOLBase::constraint_eval(), SOLBase::constraintJacMatrixF77, SOLBase::constraintState, SOLBase::constrOffset, Model::continuous_lower_bounds(), Model::continuous_upper_bounds(), Model::continuous_variables(), Dakota::copy_data(), Dakota::copy_data_partial(), SOLBase::deallocate_arrays(), SOLBase::fnEvalCntr, SOLBase::informResult, SOLBase::intWorkSpace, SOLBase::intWorkSpaceSize, Iterator::iteratedModel, NLSSOLLeastSq::least_sq_eval(), SOLBase::linConstraintArraySize, SOLBase::linConstraintMatrixF77, Model::linear_eq_constraint_coeffs(), Model::linear_ineq_constraint_coeffs(), SOLBase::nlnConstraintArraySize, NLSSOLLeastSq::nlssolInstance, SOLBase::numberIterations, Minimizer::numContinuousVars, LeastSq::numLeastSqTerms, Minimizer::numLinearConstraints, Minimizer::numNonlinearConstraints, Minimizer::numUserPrimaryFns, SOLBase::optLSqInstance, Minimizer::prevMinInstance, SOLBase::realWorkSpace, SOLBase::realWorkSpaceSize, LeastSq::retrievedIterPriFns, SOLBase::solInstance, and SOLBase::upperFactorHessianF77.