Dakota  Version
Explore and Predict with Confidence
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
DiscrepancyCorrection Class Reference

Base class for discrepancy corrections. More...

Public Member Functions

 DiscrepancyCorrection ()
 default constructor
 
 DiscrepancyCorrection (Model &surr_model, const SizetSet &surr_fn_indices, short corr_type, short corr_order, String approx_type="local_taylor", short approx_order=SHRT_MAX)
 standard constructor
 
 DiscrepancyCorrection (const SizetSet &surr_fn_indices, size_t num_fns, size_t num_vars, short corr_type, short corr_order, String approx_type="local_taylor", short approx_order=SHRT_MAX)
 alternate constructor
 
 ~DiscrepancyCorrection ()
 destructor
 
void initialize (Model &surr_model, const SizetSet &surr_fn_indices, short corr_type, short corr_order, String approx_type="local_taylor", short approx_order=SHRT_MAX)
 initialize the DiscrepancyCorrection data
 
void initialize (const SizetSet &surr_fn_indices, size_t num_fns, size_t num_vars, short corr_type, short corr_order, String approx_type="local_taylor", short approx_order=SHRT_MAX)
 initialize the DiscrepancyCorrection data
 
void compute (const Variables &vars, const Response &truth_response, const Response &approx_response, bool quiet_flag=false)
 compute the correction required to bring approx_response into agreement with truth_response and store in {add,mult}Corrections More...
 
void compute (const Response &truth_response, const Response &approx_response, Response &discrepancy_response, bool quiet_flag=false)
 compute the correction required to bring approx_response into agreement with truth_response and store in discrepancy_response
 
void compute (const VariablesArray &vars_array, const ResponseArray &truth_response_array, const ResponseArray &approx_response, bool quiet_flag=false)
 compute the correction required to bring approx_response into agreement with truth_response as a function of the variables and store in {add,mult}Corrections
 
void apply (const Variables &vars, Response &approx_response, bool quiet_flag=false)
 apply the correction computed in compute() to approx_response
 
void compute_variance (const VariablesArray &vars_array, RealMatrix &approx_variance, bool quiet_flag=false)
 compute the variance of approx_response
 
void correction_type (short corr_type)
 update correctionType
 
short correction_type () const
 return correctionType
 
void correction_order (short order)
 update correctionOrder
 
short correction_order () const
 return correctionOrder
 
void data_order (short order)
 update dataOrder
 
short data_order () const
 return dataOrder
 
bool computed () const
 return correctionComputed
 
bool initialized () const
 return initializedFlag
 

Protected Attributes

SizetSet surrogateFnIndices
 for mixed response sets, this array specifies the response function subset that is approximated
 
bool initializedFlag
 indicates that discrepancy correction instance has been initialized following construction
 
short correctionType
 approximation correction approach to be used: NO_CORRECTION, ADDITIVE_CORRECTION, MULTIPLICATIVE_CORRECTION, or COMBINED_CORRECTION.
 
short correctionOrder
 approximation correction order to be used: 0, 1, or 2
 
short dataOrder
 order of correction data in 3-bit format: overlay of 1 (value), 2 (gradient), and 4 (Hessian)
 
bool correctionComputed
 flag indicating whether or not a correction has been computed and is available for application
 
size_t numFns
 total number of response functions (of which surrogateFnIndices may define a subset)
 
size_t numVars
 number of continuous variables active in the correction
 

Private Member Functions

void initialize (short corr_type, short corr_order, String approx_type, short approx_order)
 initialize types and orders
 
void initialize_corrections ()
 internal convenience function shared by overloaded initialize() variants
 
bool check_multiplicative (const RealVector &truth_fns, const RealVector &approx_fns)
 define badScalingFlag
 
void compute_additive (const Response &truth_response, const Response &approx_response, int index, Real &discrep_fn, RealVector &discrep_grad, RealSymMatrix &discrep_hess)
 internal convenience function for computing additive corrections between truth and approximate responses
 
void compute_multiplicative (const Response &truth_response, const Response &approx_response, int index, Real &discrep_fn, RealVector &discrep_grad, RealSymMatrix &discrep_hess)
 internal convenience function for computing multiplicative corrections between truth and approximate responses
 
void apply_additive (const Variables &vars, Response &approx_response)
 internal convenience function for applying additive corrections to an approximate response
 
void apply_multiplicative (const Variables &vars, Response &approx_response)
 internal convenience function for applying multiplicative corrections to an approximate response
 
void apply_additive (const Variables &vars, RealVector &approx_fns)
 internal convenience function for applying additive corrections to a set of response functions
 
void apply_multiplicative (const Variables &vars, RealVector &approx_fns)
 internal convenience function for applying multiplicative corrections to a set of response functions
 
const Responsesearch_db (const Variables &search_vars, const ShortArray &search_asv)
 search data_pairs for missing approximation data
 

Private Attributes

Pecos::DiscrepancyCalculator discrepCalc
 helper utility for calculating discrepancies
 
bool badScalingFlag
 flag used to indicate function values near zero for multiplicative corrections; triggers an automatic switch to additive corrections
 
bool computeAdditive
 flag indicating the need for additive correction calculations
 
bool computeMultiplicative
 flag indicating the need for multiplicative correction calculations
 
String approxType
 string indicating the discrepancy approximation type
 
short approxOrder
 polynomial order of the discrepancy approximation (basis or trend order)
 
bool addAnchor
 flag indicating that data additions are anchor points (for updating local and multipoint approximations)
 
SharedApproxData sharedData
 data that is shared among all correction Approximations
 
std::vector< ApproximationaddCorrections
 array of additive corrections; surrogate models of a model discrepancy function (formed from model differences)
 
std::vector< ApproximationmultCorrections
 array of multiplicative corrections; surrogate models of a model discrepancy function (formed from model ratios)
 
Model surrModel
 shallow copy of the surrogate model instance as returned by Model::surrogate_model() (the DataFitSurrModel or or one of EnsembleSurrModel::approxModels)
 
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.
 
Variables correctionPrevCenterPt
 copy of center point from the previous correction cycle
 
RealVector truthFnsCenter
 truth function values at the current correction point
 
RealVector approxFnsCenter
 Surrogate function values at the current correction point.
 
RealMatrix approxGradsCenter
 Surrogate gradient values at the current correction point.
 
RealVector truthFnsPrevCenter
 copy of truth function values at center of previous correction cycle
 
RealVector approxFnsPrevCenter
 copy of approximate function values at center of previous correction cycle
 

Detailed Description

Base class for discrepancy corrections.

The DiscrepancyCorrection class provides common functions for computing and applying corrections to approximations.

Member Function Documentation

◆ compute()

void compute ( const Variables vars,
const Response truth_response,
const Response approx_response,
bool  quiet_flag = false 
)

compute the correction required to bring approx_response into agreement with truth_response and store in {add,mult}Corrections

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.

References Response::active_set(), Approximation::add(), DiscrepancyCorrection::addAnchor, DiscrepancyCorrection::addCorrections, DiscrepancyCorrection::apply(), DiscrepancyCorrection::apply_additive(), DiscrepancyCorrection::apply_multiplicative(), DiscrepancyCorrection::approxFnsCenter, DiscrepancyCorrection::approxFnsPrevCenter, DiscrepancyCorrection::approxGradsCenter, DiscrepancyCorrection::badScalingFlag, Approximation::clear_current_active_data(), DiscrepancyCorrection::combineFactors, DiscrepancyCorrection::computeAdditive, DiscrepancyCorrection::computeMultiplicative, Variables::continuous_variables(), Response::copy(), DiscrepancyCorrection::correctionComputed, DiscrepancyCorrection::correctionOrder, DiscrepancyCorrection::correctionPrevCenterPt, DiscrepancyCorrection::correctionType, DiscrepancyCorrection::dataOrder, DiscrepancyCorrection::discrepCalc, Variables::discrete_int_variables(), Variables::discrete_real_variables(), Response::function_gradient_view(), Response::function_gradients(), Response::function_hessian(), Response::function_value(), Response::function_values(), Model::is_null(), DiscrepancyCorrection::multCorrections, DiscrepancyCorrection::numFns, DiscrepancyCorrection::numVars, ActiveSet::request_values(), DiscrepancyCorrection::sharedData, DiscrepancyCorrection::surrModel, DiscrepancyCorrection::surrogateFnIndices, DiscrepancyCorrection::truthFnsCenter, and DiscrepancyCorrection::truthFnsPrevCenter.

Referenced by DiscrepancyCorrection::compute(), EnsembleSurrModel::compute_apply_delta(), DataFitSurrModel::derived_evaluate(), DataFitSurrModel::derived_synchronize(), DataFitSurrModel::derived_synchronize_nowait(), and EnsembleSurrModel::single_apply().


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