Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
SurrogateModel Class Reference

Base class for surrogate models (DataFitSurrModel and HierarchSurrModel). More...

Inheritance diagram for SurrogateModel:
Model DataFitSurrModel HierarchSurrModel

List of all members.

Protected Member Functions

 SurrogateModel (ProblemDescDB &problem_db)
 constructor
 SurrogateModel (ParallelLibrary &parallel_lib, const SharedVariablesData &svd, const ActiveSet &set, const String &corr_type, short corr_order)
 alternate constructor
 ~SurrogateModel ()
 destructor
Modelsubordinate_model ()
 return truth_model()
void compute_correction (const Response &truth_response, const Response &approx_response, const RealVector &c_vars)
 compute the correction required to bring approx_response into agreement with truth_response
void apply_correction (Response &approx_response, const RealVector &c_vars, bool quiet_flag=false)
 apply the correction computed in compute_correction() to approx_response
void auto_correction (bool correction_flag)
 sets autoCorrection to on (true) or off (false)
bool auto_correction ()
 returns autoCorrection setting
void check_submodel_compatibility (const Model &sub_model)
 verify compatibility between SurrogateModel attributes and attributes of the submodel (DataFitSurrModel::actualModel or HierarchSurrModel::highFidelityModel)
bool force_rebuild ()
 evaluate whether a rebuild of the approximation should be forced based on changes in the inactive data
void asv_mapping (const ShortArray &orig_asv, ShortArray &actual_asv, ShortArray &approx_asv, bool build_flag)
 distributes the incoming orig_asv among actual_asv and approx_asv
void asv_mapping (const ShortArray &actual_asv, const ShortArray &approx_asv, ShortArray &combined_asv)
 reconstitutes a combined_asv from actual_asv and approx_asv
void response_mapping (const Response &actual_response, const Response &approx_response, Response &combined_response)
 overlays actual_response and approx_response to update combined_response

Protected Attributes

bool mixedResponseSet
 flag for mixed approximate/actual responses
IntSet surrogateFnIndices
 for mixed response sets, this array specifies the response function subset that is approximated
IntResponseMap surrResponseMap
 map of surrogate responses used in derived_synchronize() and derived_synchronize_nowait() functions
IntRealVectorMap rawCVarsMap
 map of raw continuous variables used by apply_correction(). Model::varsList cannot be used for this purpose since it does not contain lower level variables sets from finite differencing.
IntIntMap truthIdMap
 map from actualModel/highFidelityModel evaluation ids to DataFitSurrModel/HierarchSurrModel ids
IntIntMap surrIdMap
 map from approxInterface/lowFidelityModel evaluation ids to DataFitSurrModel/HierarchSurrModel ids
IntResponseMap cachedApproxRespMap
 map of approximate responses retrieved in derived_synchronize_nowait() that could not be returned since corresponding truth model response portions were still pending.
String correctionType
 approximation correction approach to be used: additive or multiplicative
short correctionOrder
 approximation correction order to be used: 0, 1, or 2
bool autoCorrection
 a flag which controls the use of apply_correction() in DataFitSurrModel and HierarchSurrModel approximate response computations
bool correctionComputed
 flag indicating whether or not a correction has been computed and is available for application
size_t approxBuilds
 number of calls to build_approximation()
bool surrogateBypass
 a flag which allows bypassing the approximation for evaluations on the underlying truth model.
RealVector referenceCLBnds
 stores a reference copy of active continuous lower bounds when the approximation is built; used to detect when a rebuild is required.
RealVector referenceCUBnds
 stores a reference copy of active continuous upper bounds when the approximation is built; used to detect when a rebuild is required.
IntVector referenceDILBnds
 stores a reference copy of active discrete int lower bounds when the approximation is built; used to detect when a rebuild is required.
IntVector referenceDIUBnds
 stores a reference copy of active discrete int upper bounds when the approximation is built; used to detect when a rebuild is required.
RealVector referenceDRLBnds
 stores a reference copy of active discrete real lower bounds when the approximation is built; used to detect when a rebuild is required.
RealVector referenceDRUBnds
 stores a reference copy of active discrete real upper bounds when the approximation is built; used to detect when a rebuild is required.
RealVector referenceICVars
 stores a reference copy of the inactive continuous variables when the approximation is built using a Distinct view; used to detect when a rebuild is required.
IntVector referenceIDIVars
 stores a reference copy of the inactive discrete int variables when the approximation is built using a Distinct view; used to detect when a rebuild is required.
RealVector referenceIDRVars
 stores a reference copy of the inactive discrete real variables when the approximation is built using a Distinct view; used to detect when a rebuild is required.

Private Member Functions

void apply_additive_correction (RealVector &alpha_corrected_fns, RealMatrix &alpha_corrected_grads, RealSymMatrixArray &alpha_corrected_hessians, const RealVector &c_vars, const ActiveSet &set)
 internal convenience function for applying additive corrections
void apply_multiplicative_correction (RealVector &beta_corrected_fns, RealMatrix &beta_corrected_grads, RealSymMatrixArray &beta_corrected_hessians, const RealVector &c_vars, const ActiveSet &set)
 internal convenience function for applying multiplicative corrections

Private Attributes

bool badScalingFlag
 flag used to indicate function values near zero for multiplicative corrections; triggers an automatic switch to additive corrections
bool combinedFlag
 flag indicating the combination of additive/multiplicative corrections
bool computeAdditive
 flag indicating the need for additive correction calculations
bool computeMultiplicative
 flag indicating the need for multiplicative correction calculations
RealVector addCorrFns
 0th-order additive correction term: equals the difference between high and low fidelity model values at x=x_center.
RealMatrix addCorrGrads
 1st-order additive correction term: equals the gradient of the high/low function difference at x=x_center.
RealSymMatrixArray addCorrHessians
 2nd-order additive correction term: equals the Hessian of the high/low function difference at x=x_center.
RealVector multCorrFns
 0th-order multiplicative correction term: equals the ratio of high fidelity to low fidelity model values at x=x_center.
RealMatrix multCorrGrads
 1st-order multiplicative correction term: equals the gradient of the high/low function ratio at x=x_center.
RealSymMatrixArray multCorrHessians
 2nd-order multiplicative correction term: equals the Hessian of the high/low function ratio at x=x_center.
RealVector combineFactors
 factors for combining additive and multiplicative corrections. Each factor is the weighting applied to the additive correction and 1.-factor is the weighting applied to the multiplicative correction. The factor value is determined by an additional requirement to match the high fidelity function value at the previous correction point (e.g., previous trust region center). This results in a multipoint correction instead of a strictly local correction.
RealVector correctionCenterPt
 The point in parameter space where the current correction is calculated (often the center of the current trust region). Used in calculating (x - x_c) terms in 1st-/2nd-order corrections.
RealVector correctionPrevCenterPt
 copy of correctionCenterPt from the previous correction cycle
RealVector approxFnsCenter
 Surrogate function values at the current correction point which are needed as a fall back if the current surrogate function values are unavailable when applying 1st-/2nd-order multiplicative corrections.
RealVector approxFnsPrevCenter
 copy of approxFnsCenter from the previous correction cycle
RealMatrix approxGradsCenter
 Surrogate gradient values at the current correction point which are needed as a fall back if the current surrogate function gradients are unavailable when applying 1st-/2nd-order multiplicative corrections.
RealVector truthFnsCenter
 Truth function values at the current correction point.
RealVector truthFnsPrevCenter
 copy of truthFnsCenter from the previous correction cycle
Variables subModelVars
 copy of the truth model variables object used to simplify conversion among differing variable views in force_rebuild()
Constraints subModelCons
 copy of the truth model constraints object used to simplify conversion among differing variable views in force_rebuild()

Detailed Description

Base class for surrogate models (DataFitSurrModel and HierarchSurrModel).

The SurrogateModel class provides common functions to derived classes for computing and applying corrections to approximations.


Member Function Documentation

void compute_correction ( const Response truth_response,
const Response approx_response,
const RealVector &  c_vars 
) [protected, virtual]

compute the correction required to bring approx_response into agreement with truth_response

Compute an additive or multiplicative correction that corrects the approx_response to have 0th-order consistency (matches values), 1st-order consistency (matches values and gradients), or 2nd-order consistency (matches values, gradients, and Hessians) with the truth_response at a single point (e.g., the center of a trust region). The 0th-order, 1st-order, and 2nd-order corrections use scalar values, linear scaling functions, and quadratic scaling functions, respectively, for each response function.

Reimplemented from Model.

References Response::active_set(), SurrogateModel::addCorrFns, SurrogateModel::addCorrGrads, SurrogateModel::addCorrHessians, SurrogateModel::apply_additive_correction(), SurrogateModel::apply_correction(), SurrogateModel::apply_multiplicative_correction(), SurrogateModel::approxFnsCenter, SurrogateModel::approxFnsPrevCenter, SurrogateModel::approxGradsCenter, SurrogateModel::badScalingFlag, SurrogateModel::combinedFlag, SurrogateModel::combineFactors, SurrogateModel::computeAdditive, SurrogateModel::computeMultiplicative, Response::copy(), Dakota::copy_data(), SurrogateModel::correctionCenterPt, SurrogateModel::correctionComputed, SurrogateModel::correctionOrder, SurrogateModel::correctionPrevCenterPt, Response::function_gradients(), Response::function_hessians(), Response::function_values(), SurrogateModel::multCorrFns, SurrogateModel::multCorrGrads, SurrogateModel::multCorrHessians, Model::numDerivVars, Model::numFns, ActiveSet::request_values(), SurrogateModel::surrogateFnIndices, SurrogateModel::truthFnsCenter, SurrogateModel::truthFnsPrevCenter, and Dakota::write_col_vector_trans().

Referenced by HierarchSurrModel::derived_compute_response(), HierarchSurrModel::derived_synchronize(), and HierarchSurrModel::derived_synchronize_nowait().

bool force_rebuild ( ) [protected, virtual]

evaluate whether a rebuild of the approximation should be forced based on changes in the inactive data

This function forces a rebuild of the approximation according to the sub-model variables view, the approximation type, and whether the active approximation bounds or inactive variable values have changed since the last approximation build.

Reimplemented from Model.

References Constraints::all_continuous_lower_bounds(), Constraints::all_continuous_upper_bounds(), Variables::all_continuous_variables(), Constraints::all_discrete_int_lower_bounds(), Constraints::all_discrete_int_upper_bounds(), Variables::all_discrete_int_variables(), Constraints::all_discrete_real_lower_bounds(), Constraints::all_discrete_real_upper_bounds(), Variables::all_discrete_real_variables(), String::begins(), Model::continuous_lower_bounds(), Constraints::continuous_lower_bounds(), Model::continuous_upper_bounds(), Constraints::continuous_upper_bounds(), Variables::continuous_variables(), Constraints::copy(), Variables::copy(), Model::current_variables(), Model::currentVariables, Model::discrete_int_lower_bounds(), Constraints::discrete_int_lower_bounds(), Model::discrete_int_upper_bounds(), Constraints::discrete_int_upper_bounds(), Variables::discrete_int_variables(), Model::discrete_real_lower_bounds(), Constraints::discrete_real_lower_bounds(), Model::discrete_real_upper_bounds(), Constraints::discrete_real_upper_bounds(), Variables::discrete_real_variables(), Variables::inactive_continuous_variables(), Variables::inactive_discrete_int_variables(), Variables::inactive_discrete_real_variables(), Constraints::is_null(), Variables::is_null(), Model::is_null(), Model::model_type(), SurrogateModel::referenceCLBnds, SurrogateModel::referenceCUBnds, SurrogateModel::referenceDILBnds, SurrogateModel::referenceDIUBnds, SurrogateModel::referenceDRLBnds, SurrogateModel::referenceDRUBnds, SurrogateModel::referenceICVars, SurrogateModel::referenceIDIVars, SurrogateModel::referenceIDRVars, SurrogateModel::subModelCons, SurrogateModel::subModelVars, Model::subordinate_model(), Model::surrogateType, Model::truth_model(), Model::user_defined_constraints(), Model::userDefinedConstraints, and Variables::view().

Referenced by HierarchSurrModel::derived_asynch_compute_response(), DataFitSurrModel::derived_asynch_compute_response(), HierarchSurrModel::derived_compute_response(), and DataFitSurrModel::derived_compute_response().


Member Data Documentation

bool autoCorrection [protected]
size_t approxBuilds [protected]

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