Dakota  Version 6.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
HierarchSurrModel Class Reference

Derived model class within the surrogate model branch for managing hierarchical surrogates (models of varying fidelity). More...

Inheritance diagram for HierarchSurrModel:
SurrogateModel Model

Public Member Functions

 HierarchSurrModel (ProblemDescDB &problem_db)
 constructor
 
 ~HierarchSurrModel ()
 destructor
 

Protected Member Functions

void derived_evaluate (const ActiveSet &set)
 portion of evaluate() specific to HierarchSurrModel More...
 
void derived_evaluate_nowait (const ActiveSet &set)
 portion of evaluate_nowait() specific to HierarchSurrModel More...
 
const IntResponseMap & derived_synchronize ()
 portion of synchronize() specific to HierarchSurrModel More...
 
const IntResponseMap & derived_synchronize_nowait ()
 portion of synchronize_nowait() specific to HierarchSurrModel More...
 
Modelsurrogate_model ()
 return the active low fidelity model
 
void surrogate_model_indices (size_t lf_model_index, size_t lf_soln_lev_index=_NPOS)
 set the indices identifying the active low fidelity model
 
void surrogate_model_indices (const SizetSizetPair &lf_form_level)
 set the index pair identifying the active low fidelity model
 
const SizetSizetPair & surrogate_model_indices () const
 return the indices identifying the active low fidelity model
 
Modeltruth_model ()
 return the active high fidelity model
 
void truth_model_indices (size_t hf_model_index, size_t hf_soln_lev_index=_NPOS)
 set the indices identifying the active high fidelity model
 
void truth_model_indices (const SizetSizetPair &hf_form_level)
 set the index pair identifying the active high fidelity model
 
const SizetSizetPair & truth_model_indices () const
 return the indices identifying the active high fidelity model
 
void derived_subordinate_models (ModelList &ml, bool recurse_flag)
 return orderedModels and, optionally, their sub-model recursions
 
void primary_response_fn_weights (const RealVector &wts, bool recurse_flag=true)
 set the relative weightings for multiple objective functions or least squares terms and optionally recurses into LF/HF models
 
void surrogate_response_mode (short mode)
 set responseMode and pass any bypass request on to the high fidelity model for any lower-level surrogate recursions
 
void surrogate_function_indices (const IntSet &surr_fn_indices)
 (re)set the surrogate index set in SurrogateModel::surrogateFnIndices
 
void build_approximation ()
 use the high fidelity model to compute the truth values needed for correction of the low fidelity model results
 
void component_parallel_mode (short mode)
 update component parallel mode for supporting parallelism in the low ad high fidelity models
 
IntIntPair estimate_partition_bounds (int max_eval_concurrency)
 estimate the minimum and maximum partition sizes that can be utilized by this Model
 
void derived_init_communicators (ParLevLIter pl_iter, int max_eval_concurrency, bool recurse_flag=true)
 set up parallel operations for the array of ordered model fidelities
 
void derived_init_serial ()
 set up serial operations for the array of ordered model fidelities
 
void derived_set_communicators (ParLevLIter pl_iter, int max_eval_concurrency, bool recurse_flag=true)
 set active parallel configuration within the current low and high fidelity models identified by {low,high}FidelityIndices
 
void derived_free_communicators (ParLevLIter pl_iter, int max_eval_concurrency, bool recurse_flag=true)
 deallocate communicator partitions for the HierarchSurrModel (request forwarded to the the array of ordered model fidelities)
 
void serve_run (ParLevLIter pl_iter, int max_eval_concurrency)
 Service the low and high fidelity model job requests received from the master; completes when termination message received from stop_servers().
 
void stop_servers ()
 Executed by the master to terminate the low and high fidelity model server operations when iteration on the HierarchSurrModel is complete.
 
void inactive_view (short view, bool recurse_flag=true)
 update the Model's inactive view based on higher level (nested) context and optionally recurse into
 
int evaluation_id () const
 Return the current evaluation id for the HierarchSurrModel. More...
 
void set_evaluation_reference ()
 set the evaluation counter reference points for the HierarchSurrModel (request forwarded to the low and high fidelity models)
 
void fine_grained_evaluation_counters ()
 request fine-grained evaluation reporting within the low and high fidelity models
 
void print_evaluation_summary (std::ostream &s, bool minimal_header=false, bool relative_count=true) const
 print the evaluation summary for the HierarchSurrModel (request forwarded to the low and high fidelity models)
 
- Protected Member Functions inherited from SurrogateModel
 SurrogateModel (ProblemDescDB &problem_db)
 constructor
 
 SurrogateModel (ProblemDescDB &problem_db, ParallelLibrary &parallel_lib, const SharedVariablesData &svd, const SharedResponseData &srd, const ActiveSet &set, short output_level)
 alternate constructor
 
 ~SurrogateModel ()
 destructor
 
Modelsubordinate_model ()
 return truth_model()
 
short surrogate_response_mode () const
 return responseMode
 
size_t mi_parallel_level_index () const
 return miPLIndex
 
DiscrepancyCorrectiondiscrepancy_correction ()
 return deltaCorr
 
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 More...
 
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 Member Functions inherited from Model
 Model (BaseConstructor, ProblemDescDB &problem_db)
 constructor initializing the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139) More...
 
 Model (LightWtBaseConstructor, ProblemDescDB &problem_db, ParallelLibrary &parallel_lib, const SharedVariablesData &svd, const SharedResponseData &srd, const ActiveSet &set, short output_level)
 constructor initializing base class for derived model class instances constructed on the fly
 
 Model (LightWtBaseConstructor, ProblemDescDB &problem_db, ParallelLibrary &parallel_lib)
 constructor initializing base class for recast model instances More...
 
void set_ie_asynchronous_mode (int max_eval_concurrency)
 default logic for defining asynchEvalFlag and evaluationCapacity based on ie_pl settings
 
void string_variable_max (const StringSetArray &ssa, size_t offset, Variables &vars)
 set the current value of each string variable offset + i to the longest string value found in the admissible string set ssa[i]
 
void string_variable_max (const StringRealMapArray &srma, size_t offset, Variables &vars)
 set the current value of each string variable offset + i to the longest string value found in the admissible string map srma[i]
 
SizetMultiArrayConstView initialize_x0_bounds (const SizetArray &original_dvv, bool &active_derivs, bool &inactive_derivs, RealVector &x0, RealVector &fd_lb, RealVector &fd_ub) const
 Initialize data needed for computing finite differences (active/inactive, center point, and bounds)
 
Real forward_grad_step (size_t num_deriv_vars, size_t xj_index, Real x0_j, Real lb_j, Real ub_j)
 Compute the forward step for a finite difference gradient; updates shortStep.
 

Private Member Functions

void update_model (Model &model)
 update the passed model (low or high fidelity) with current variable values/bounds/labels
 
const IntResponseMap & derived_synchronize_same_model ()
 called from derived_synchronize() for case of a shared model form between low and high fidelity, resulting in a single combined job queue
 
const IntResponseMap & derived_synchronize_competing ()
 called from derived_synchronize() for case of distinct model forms with competing job queues
 
const IntResponseMap & derived_synchronize_distinct_model ()
 called from derived_synchronize() for case of distinct model forms without competing job queues
 
void derived_synchronize_combine (const IntResponseMap &hf_resp_map, IntResponseMap &lf_resp_map, IntResponseMap &combined_resp_map)
 combine the HF and LF response maps into a combined response map according to the responseMode
 
const IntResponseMap & derived_synchronize_same_model_nowait ()
 called from derived_synchronize_nowait() for case of a shared model form between low and high fidelity, resulting in a single combined job queue
 
const IntResponseMap & derived_synchronize_distinct_model_nowait ()
 called from derived_synchronize_nowait() for case of distinct model forms with separate job queues
 
void derived_synchronize_combine_nowait (const IntResponseMap &hf_resp_map, IntResponseMap &lf_resp_map, IntResponseMap &combined_resp_map)
 combine the available components from HF and LF response maps into a combined response map according to the responseMode
 
void resize_response ()
 resize currentResponse based on responseMode
 
void aggregate_response (const Response &hf_resp, const Response &lf_resp, Response &agg_resp)
 aggregate LF and HF response to create a new response with 2x size
 
void compute_apply_delta (IntResponseMap &lf_resp_map)
 helper function used in the AUTO_CORRECTED_SURROGATE responseMode for computing a correction and applying it to lf_resp_map
 
void check_key (int key1, int key2) const
 check for consistency in response map keys
 

Private Attributes

int hierModelEvalCntr
 number of calls to derived_evaluate()/derived_evaluate_nowait()
 
ModelArray orderedModels
 Ordered sequence (low to high) of model fidelities. Models are of arbitrary type and supports recursions.
 
SizetSizetPair lowFidelityIndices
 index of the low fidelity model that is currently active within orderedModels; provides approximate low fidelity function evaluations.
 
SizetSizetPair highFidelityIndices
 index of the high fidelity model that is currently active within orderedModels; provides truth evaluations for computing corrections to the low fidelity results.
 
bool sameModelForm
 flag indicating that the {low,high}FidelityIndices correspond to the same model instance, requiring modifications to the updating process
 
Response truthResponseRef
 the reference truth (high fidelity) response computed in build_approximation() and used for calculating corrections
 
IntResponseMap cachedTruthRespMap
 map of truth (high-fidelity) responses retrieved in derived_synchronize_nowait() that could not be returned since corresponding low-fidelity response portions were still pending
 

Additional Inherited Members

- Protected Attributes inherited from SurrogateModel
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
 
IntVariablesMap rawVarsMap
 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.hppierarchSurrModel ids
 
IntIntMap surrIdMap
 map from approxInterface/lowFidelityModel evaluation ids to DataFitSurrModel.hppierarchSurrModel 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.
 
short responseMode
 an enumeration that controls the response calculation mode in {DataFit,Hierarch}SurrModel approximate response computations More...
 
size_t approxBuilds
 number of calls to build_approximation() More...
 
size_t miPLIndex
 the index of the active metaiterator-iterator parallelism level (corresponding to ParallelConfiguration::miPLIters) used at runtime
 
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.
 
StringMultiArray referenceIDSVars
 stores a reference copy of the inactive discrete string 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.
 
DiscrepancyCorrection deltaCorr
 manages construction and application of correction functions that are applied to a surrogate model (DataFitSurr or HierarchSurr) in order to reproduce high fidelity data.
 

Detailed Description

Derived model class within the surrogate model branch for managing hierarchical surrogates (models of varying fidelity).

The HierarchSurrModel class manages hierarchical models of varying fidelity. The class contains an ordered array of model forms (fidelity ordered from low to high), where each model form may also contain a set of solution levels (space/time discretization, convergence tolerances, etc.). At run time, one of these combinations is activated as the low fidelity model and used to perform approximate function evaluations, while another of these combinations is activated as the high fidelity model and used to provide truth evaluations for computing corrections to the low fidelity results.

Member Function Documentation

void derived_evaluate ( const ActiveSet set)
protectedvirtual
void derived_evaluate_nowait ( const ActiveSet set)
protectedvirtual

portion of evaluate_nowait() specific to HierarchSurrModel

Compute the response asynchronously using LF model, HF model, or both (mixed case). For the LF model portion, compute the high fidelity response with build_approximation() (for correcting the low fidelity results in derived_synchronize() and derived_synchronize_nowait()) if not performed previously.

Reimplemented from Model.

References DiscrepancyCorrection::apply(), SurrogateModel::approxBuilds, SurrogateModel::asv_mapping(), Model::asynch_flag(), HierarchSurrModel::build_approximation(), SurrogateModel::cachedApproxRespMap, HierarchSurrModel::cachedTruthRespMap, HierarchSurrModel::component_parallel_mode(), DiscrepancyCorrection::compute(), DiscrepancyCorrection::computed(), Response::copy(), Variables::copy(), Model::current_response(), Model::currentVariables, SurrogateModel::deltaCorr, ActiveSet::derivative_vector(), Model::eval_tag_prefix(), Model::evalTagPrefix, Model::evaluate(), Model::evaluate_nowait(), Model::evaluation_id(), SurrogateModel::force_rebuild(), Model::hierarchicalTagging, HierarchSurrModel::hierModelEvalCntr, HierarchSurrModel::highFidelityIndices, HierarchSurrModel::lowFidelityIndices, HierarchSurrModel::orderedModels, Model::outputLevel, SurrogateModel::rawVarsMap, ActiveSet::request_vector(), SurrogateModel::responseMode, HierarchSurrModel::sameModelForm, Model::solution_level_index(), SurrogateModel::surrIdMap, SurrogateModel::truthIdMap, HierarchSurrModel::truthResponseRef, and HierarchSurrModel::update_model().

const IntResponseMap & derived_synchronize ( )
protectedvirtual

portion of synchronize() specific to HierarchSurrModel

Blocking retrieval of asynchronous evaluations from LF model, HF model, or both (mixed case). For the LF model portion, apply correction (if active) to each response in the array. derived_synchronize() is designed for the general case where derived_evaluate_nowait() may be inconsistent in its use of low fidelity evaluations, high fidelity evaluations, or both.

Reimplemented from Model.

References HierarchSurrModel::derived_synchronize_competing(), HierarchSurrModel::derived_synchronize_distinct_model(), HierarchSurrModel::derived_synchronize_same_model(), HierarchSurrModel::sameModelForm, SurrogateModel::surrIdMap, SurrogateModel::surrResponseMap, and SurrogateModel::truthIdMap.

const IntResponseMap & derived_synchronize_nowait ( )
protectedvirtual

portion of synchronize_nowait() specific to HierarchSurrModel

Nonblocking retrieval of asynchronous evaluations from LF model, HF model, or both (mixed case). For the LF model portion, apply correction (if active) to each response in the map. derived_synchronize_nowait() is designed for the general case where derived_evaluate_nowait() may be inconsistent in its use of actual evals, approx evals, or both.

Reimplemented from Model.

References HierarchSurrModel::derived_synchronize_distinct_model_nowait(), HierarchSurrModel::derived_synchronize_same_model_nowait(), HierarchSurrModel::sameModelForm, and SurrogateModel::surrResponseMap.

Referenced by HierarchSurrModel::derived_synchronize_competing().

int evaluation_id ( ) const
inlineprotectedvirtual

Return the current evaluation id for the HierarchSurrModel.

return the hierarchical model evaluation count. Due to possibly intermittent use of surrogate bypass, this is not the same as either the loFi or hiFi model evaluation counts. It also does not distinguish duplicate evals.

Reimplemented from Model.

References HierarchSurrModel::hierModelEvalCntr.


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