$extrastylesheet
Dakota  Version 6.2
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
RecastModel Class Reference

Derived model class which provides a thin wrapper around a sub-model in order to recast the form of its inputs and/or outputs. More...

Inheritance diagram for RecastModel:
Model

List of all members.

Public Member Functions

 RecastModel (const Model &sub_model, const Sizet2DArray &vars_map_indices, const SizetArray &vars_comps_total, const BitArray &all_relax_di, const BitArray &all_relax_dr, bool nonlinear_vars_mapping, void(*variables_map)(const Variables &recast_vars, Variables &sub_model_vars), void(*set_map)(const Variables &recast_vars, const ActiveSet &recast_set, ActiveSet &sub_model_set), const Sizet2DArray &primary_resp_map_indices, const Sizet2DArray &secondary_resp_map_indices, size_t recast_secondary_offset, const BoolDequeArray &nonlinear_resp_mapping, void(*primary_resp_map)(const Variables &sub_model_vars, const Variables &recast_vars, const Response &sub_model_response, Response &recast_response), void(*secondary_resp_map)(const Variables &sub_model_vars, const Variables &recast_vars, const Response &sub_model_response, Response &recast_response))
 standard constructor
 RecastModel (const Model &sub_model, const SizetArray &vars_comps_totals, const BitArray &all_relax_di, const BitArray &all_relax_dr, size_t num_recast_primary_fns, size_t num_recast_secondary_fns, size_t recast_secondary_offset)
 alternate constructor
 ~RecastModel ()
 destructor
void initialize (const Sizet2DArray &vars_map_indices, bool nonlinear_vars_mapping, void(*variables_map)(const Variables &recast_vars, Variables &sub_model_vars), void(*set_map)(const Variables &recast_vars, const ActiveSet &recast_set, ActiveSet &sub_model_set), const Sizet2DArray &primary_resp_map_indices, const Sizet2DArray &secondary_resp_map_indices, const BoolDequeArray &nonlinear_resp_mapping, void(*primary_resp_map)(const Variables &sub_model_vars, const Variables &recast_vars, const Response &sub_model_response, Response &recast_response), void(*secondary_resp_map)(const Variables &sub_model_vars, const Variables &recast_vars, const Response &sub_model_response, Response &recast_response))
 completes initialization of the RecastModel after alternate construction
void inverse_mappings (void(*inv_vars_map)(const Variables &sub_model_vars, Variables &recast_vars), void(*inv_set_map)(const Variables &sub_model_vars, const ActiveSet &sub_model_set, ActiveSet &recast_set), void(*inv_pri_resp_map)(const Variables &recast_vars, const Variables &sub_model_vars, const Response &recast_resp, Response &sub_model_resp), void(*inv_sec_resp_map)(const Variables &recast_vars, const Variables &sub_model_vars, const Response &recast_resp, Response &sub_model_resp))
 provide optional inverse mappings
void transform_variables (const Variables &recast_vars, Variables &sub_model_vars)
 perform transformation of Variables (recast --> sub-model)
void transform_set (const Variables &recast_vars, const ActiveSet &recast_set, ActiveSet &sub_model_set)
 into sub_model_set for use with subModel.
void transform_response (const Variables &recast_vars, const Variables &sub_model_vars, const Response &sub_model_resp, Response &recast_resp)
 perform transformation of Response (sub-model --> recast)
void inverse_transform_variables (const Variables &sub_model_vars, Variables &recast_vars)
 perform inverse transformation of Variables (sub-model --> recast)
void inverse_transform_set (const Variables &sub_model_vars, const ActiveSet &sub_model_set, ActiveSet &recast_set)
 into sub_model_set for use with subModel.
void inverse_transform_response (const Variables &sub_model_vars, const Variables &recast_vars, const Response &recast_resp, Response &sub_model_resp)
 perform inverse transformation of Response (recast --> sub-model)
void submodel_supports_derivative_estimation (bool sed_flag)
 override the submodel's derivative estimation behavior

Protected Member Functions

void derived_compute_response (const ActiveSet &set)
 portion of compute_response() specific to RecastModel (forward to subModel.compute_response())
void derived_asynch_compute_response (const ActiveSet &set)
 portion of asynch_compute_response() specific to RecastModel (forward to subModel.asynch_compute_response())
const IntResponseMap & derived_synchronize ()
 portion of synchronize() specific to RecastModel (forward to subModel.synchronize())
const IntResponseMap & derived_synchronize_nowait ()
 portion of synchronize_nowait() specific to RecastModel (forward to subModel.synchronize_nowait())
Iteratorsubordinate_iterator ()
 return sub-iterator, if present, within subModel
Modelsubordinate_model ()
 return subModel
Modelsurrogate_model ()
 return surrogate model, if present, within subModel
Modeltruth_model ()
 return truth model, if present, within subModel
void derived_subordinate_models (ModelList &ml, bool recurse_flag)
 add subModel to list and recurse into subModel
void update_from_subordinate_model (bool recurse_flag=true)
 pass request to subModel if recursing and then update from it
Interfacederived_interface ()
 return subModel interface
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 subModel
void surrogate_function_indices (const IntSet &surr_fn_indices)
 update the subModel's surrogate response function indices (DataFitSurrModel::surrogateFnIndices)
void surrogate_response_mode (short mode)
 update the subModel's surrogate response mode (SurrogateModel::responseMode)
void build_approximation ()
 builds the subModel approximation
bool build_approximation (const Variables &vars, const IntResponsePair &response_pr)
 builds the subModel approximation
void update_approximation (bool rebuild_flag)
 replaces data in the subModel approximation
void update_approximation (const Variables &vars, const IntResponsePair &response_pr, bool rebuild_flag)
 replaces data in the subModel approximation
void update_approximation (const VariablesArray &vars_array, const IntResponseMap &resp_map, bool rebuild_flag)
 replaces data in the subModel approximation
void append_approximation (bool rebuild_flag)
 appends data to the subModel approximation
void append_approximation (const Variables &vars, const IntResponsePair &response_pr, bool rebuild_flag)
 appends data to the subModel approximation
void append_approximation (const VariablesArray &vars_array, const IntResponseMap &resp_map, bool rebuild_flag)
 appends data to the subModel approximation
void pop_approximation (bool save_surr_data, bool rebuild_flag=false)
 remove the previous data set addition to a surrogate (e.g., due to a previous append_approximation() call); flag manages storing of surrogate data for use in a subsequent restore_approximation()
void restore_approximation ()
 restore a previous approximation data state within a surrogate
bool restore_available ()
 query for whether a trial increment is restorable within a surrogate
void finalize_approximation ()
 finalize an approximation by applying all previous trial increments
void store_approximation ()
 move the current approximation into storage for later combination
void combine_approximation (short corr_type)
 combine the current approximation with one previously stored
std::vector< Approximation > & approximations ()
 retrieve the set of Approximations from the subModel
const RealVectorArray & approximation_coefficients (bool normalized=false)
 retrieve the approximation coefficients from the subModel
void approximation_coefficients (const RealVectorArray &approx_coeffs, bool normalized=false)
 set the approximation coefficients within the subModel
const RealVector & approximation_variances (const Variables &vars)
 retrieve the approximation variances from the subModel
const Pecos::SurrogateData & approximation_data (size_t index)
 retrieve the approximation data from the subModel
void component_parallel_mode (short mode)
 RecastModel only supports parallelism in subModel, so this virtual function redefinition is simply a sanity check.
size_t mi_parallel_level_index () const
 return subModel's MI parallel level index
short local_eval_synchronization ()
 return subModel local synchronization setting
int local_eval_concurrency ()
 return subModel local evaluation concurrency
bool derived_master_overload () const
 flag which prevents overloading the master with a multiprocessor evaluation (request forwarded to subModel)
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 RecastModel for parallel operations (request forwarded to subModel)
void derived_init_serial ()
 set up RecastModel for serial operations (request forwarded to subModel).
void derived_set_communicators (ParLevLIter pl_iter, int max_eval_concurrency, bool recurse_flag=true)
 set active parallel configuration within subModel
void derived_free_communicators (ParLevLIter pl_iter, int max_eval_concurrency, bool recurse_flag=true)
 deallocate communicator partitions for the RecastModel (request forwarded to subModel)
void serve_run (ParLevLIter pl_iter, int max_eval_concurrency)
 Service subModel job requests received from the master. Completes when a termination message is received from stop_servers().
void stop_servers ()
 executed by the master to terminate subModel server operations when RecastModel iteration 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 subModel
const String & interface_id () const
 return the subModel interface identifier
int evaluation_id () const
 return the current evaluation id for the RecastModel (request forwarded to subModel)
void set_evaluation_reference ()
 set the evaluation counter reference points for the RecastModel (request forwarded to subModel)
void fine_grained_evaluation_counters ()
 request fine-grained evaluation reporting within subModel
void print_evaluation_summary (std::ostream &s, bool minimal_header=false, bool relative_count=true) const
 print the evaluation summary for the RecastModel (request forwarded to subModel)
void eval_tag_prefix (const String &eval_id_str)
 set the hierarchical eval ID tag prefix
bool db_lookup (const Variables &search_vars, const ActiveSet &search_set, Response &found_resp)
 RecastModel may need to map variables, asv before DB lookup, or responses after lookup.

Private Member Functions

void initialize_data_from_submodel ()
 code shared among constructors to initialize base class data from submodel
void update_from_sub_model ()
 update current variables/labels/bounds/targets from subModel

Private Attributes

Model subModel
 the sub-model underlying the function pointers
Sizet2DArray varsMapIndices
 For each subModel variable, identifies the indices of the recast variables used to define it (maps RecastModel variables to subModel variables; data is packed with only the variable indices employed rather than a sparsely filled N_sm x N_r matrix)
bool nonlinearVarsMapping
 boolean set to true if the variables mapping involves a nonlinear transformation. Used in transform_set() to manage the requirement for gradients within the Hessian transformations. This does not require a BoolDeque for each individual variable, since response gradients and Hessians are managed per function, not per variable.
bool respMapping
 set to true if non-NULL primaryRespMapping or secondaryRespMapping are supplied
Sizet2DArray primaryRespMapIndices
 For each recast primary function, identifies the indices of the subModel functions used to define it (maps subModel response to RecastModel Response).
Sizet2DArray secondaryRespMapIndices
 For each recast secondary function, identifies the indices of the subModel functions used to define it (maps subModel response to RecastModel response).
BoolDequeArray nonlinearRespMapping
 array of BoolDeques, one for each recast response function. Each BoolDeque defines which subModel response functions contribute to the recast function using a nonlinear mapping. Used in transform_set() to augment the subModel function value/gradient requirements.
IntActiveSetMap recastSetMap
 map of recast active set passed to derived_asynch_compute_response(). Needed for currentResponse update in synchronization routines.
IntVariablesMap recastVarsMap
 map of recast variables used by derived_asynch_compute_response(). Needed for primaryRespMapping() and secondaryRespMapping() in synchronization routines.
IntVariablesMap subModelVarsMap
 map of subModel variables used by derived_asynch_compute_response(). Needed for primaryRespMapping() and secondaryRespMapping() in synchronization routines.
IntResponseMap recastResponseMap
 map of recast responses used by RecastModel::derived_synchronize() and RecastModel::derived_synchronize_nowait()
void(* variablesMapping )(const Variables &recast_vars, Variables &sub_model_vars)
 holds pointer for variables mapping function passed in ctor/initialize
void(* setMapping )(const Variables &recast_vars, const ActiveSet &recast_set, ActiveSet &sub_model_set)
 holds pointer for set mapping function passed in ctor/initialize
void(* primaryRespMapping )(const Variables &sub_model_vars, const Variables &recast_vars, const Response &sub_model_response, Response &recast_response)
 holds pointer for primary response mapping function passed in ctor/initialize
void(* secondaryRespMapping )(const Variables &sub_model_vars, const Variables &recast_vars, const Response &sub_model_response, Response &recast_response)
 holds pointer for secondary response mapping function passed in ctor/initialize
void(* invVarsMapping )(const Variables &sub_model_vars, Variables &recast_vars)
 holds pointer for optional inverse variables mapping function passed in inverse_mappings()
void(* invSetMapping )(const Variables &sub_model_vars, const ActiveSet &sub_model_set, ActiveSet &recast_set)
 holds pointer for optional inverse set mapping function passed in inverse_mappings()
void(* invPriRespMapping )(const Variables &recast_vars, const Variables &sub_model_vars, const Response &recast_resp, Response &sub_model_resp)
 holds pointer for optional inverse primary response mapping function passed in inverse_mappings()
void(* invSecRespMapping )(const Variables &recast_vars, const Variables &sub_model_vars, const Response &recast_resp, Response &sub_model_resp)
 holds pointer for optional inverse secondary response mapping function passed in inverse_mappings()

Detailed Description

Derived model class which provides a thin wrapper around a sub-model in order to recast the form of its inputs and/or outputs.

The RecastModel class uses function pointers to allow recasting of the subModel input/output into new problem forms. This is currently used to recast SBO approximate subproblems, but can be used for multiobjective, input/output scaling, and other problem modifications in the future.


Constructor & Destructor Documentation

RecastModel ( const Model sub_model,
const Sizet2DArray &  vars_map_indices,
const SizetArray &  vars_comps_totals,
const BitArray &  all_relax_di,
const BitArray &  all_relax_dr,
bool  nonlinear_vars_mapping,
void(*)(const Variables &recast_vars, Variables &sub_model_vars)  variables_map,
void(*)(const Variables &recast_vars, const ActiveSet &recast_set, ActiveSet &sub_model_set)  set_map,
const Sizet2DArray &  primary_resp_map_indices,
const Sizet2DArray &  secondary_resp_map_indices,
size_t  recast_secondary_offset,
const BoolDequeArray &  nonlinear_resp_mapping,
void(*)(const Variables &sub_model_vars, const Variables &recast_vars, const Response &sub_model_response, Response &recast_response)  primary_resp_map,
void(*)(const Variables &sub_model_vars, const Variables &recast_vars, const Response &sub_model_response, Response &recast_response)  secondary_resp_map 
)

standard constructor

Default recast model constructor. Requires full definition of the transformation. Parameter vars_comps_totals indicates the number of each type of variable {4 types} x {3 domains} in the recast variable space. Note: recast_secondary_offset is the start index for equality constraints, typically num nonlinear ineq constraints.

References Dakota::abort_handler(), SharedVariablesData::all_relaxed_discrete_int(), SharedVariablesData::all_relaxed_discrete_real(), SharedVariablesData::components_totals(), Response::copy(), Constraints::copy(), Variables::copy(), Model::current_response(), Model::current_variables(), Model::currentResponse, Model::currentVariables, Variables::cv(), Response::function_gradients(), Response::function_hessians(), RecastModel::initialize_data_from_submodel(), Model::modelType, RecastModel::nonlinearRespMapping, Response::num_functions(), Model::num_functions(), Constraints::num_linear_eq_constraints(), Constraints::num_linear_ineq_constraints(), Constraints::num_nonlinear_eq_constraints(), Constraints::num_nonlinear_ineq_constraints(), Model::numDerivVars, Model::numFns, RecastModel::primaryRespMapIndices, RecastModel::primaryRespMapping, Constraints::reshape(), Response::reshape(), RecastModel::respMapping, RecastModel::secondaryRespMapIndices, RecastModel::secondaryRespMapping, Variables::shared_data(), RecastModel::subModel, Model::supportsEstimDerivs, Model::user_defined_constraints(), Model::userDefinedConstraints, RecastModel::variablesMapping, and Variables::view().

RecastModel ( const Model sub_model,
const SizetArray &  vars_comps_totals,
const BitArray &  all_relax_di,
const BitArray &  all_relax_dr,
size_t  num_recast_primary_fns,
size_t  num_recast_secondary_fns,
size_t  recast_secondary_offset 
)

alternate constructor

This alternate constructor defers initialization of the function pointers until a separate call to initialize(), and accepts the minimum information needed to construct currentVariables, currentResponse, and userDefinedConstraints. The resulting model is sufficiently complete for passing to an Iterator. Parameter vars_comps_totals indicates the number of each type of variable {4 types} x {3 domains} in the recast variable space. Note: recast_secondary_offset is the start index for equality constraints, typically num nonlinear ineq constraints.

References SharedVariablesData::all_relaxed_discrete_int(), SharedVariablesData::all_relaxed_discrete_real(), SharedVariablesData::components_totals(), Response::copy(), Constraints::copy(), Variables::copy(), Model::current_response(), Model::current_variables(), Model::currentResponse, Model::currentVariables, Variables::cv(), Response::function_gradients(), Response::function_hessians(), RecastModel::initialize_data_from_submodel(), Model::modelType, Model::num_functions(), Constraints::num_linear_eq_constraints(), Constraints::num_linear_ineq_constraints(), Constraints::num_nonlinear_eq_constraints(), Constraints::num_nonlinear_ineq_constraints(), Model::numDerivVars, Model::numFns, Constraints::reshape(), Response::reshape(), Variables::shared_data(), RecastModel::subModel, Model::supportsEstimDerivs, Model::user_defined_constraints(), Model::userDefinedConstraints, RecastModel::variablesMapping, and Variables::view().


Member Function Documentation

void initialize ( const Sizet2DArray &  vars_map_indices,
bool  nonlinear_vars_mapping,
void(*)(const Variables &recast_vars, Variables &sub_model_vars)  variables_map,
void(*)(const Variables &recast_vars, const ActiveSet &recast_set, ActiveSet &sub_model_set)  set_map,
const Sizet2DArray &  primary_resp_map_indices,
const Sizet2DArray &  secondary_resp_map_indices,
const BoolDequeArray &  nonlinear_resp_mapping,
void(*)(const Variables &sub_model_vars, const Variables &recast_vars, const Response &sub_model_response, Response &recast_response)  primary_resp_map,
void(*)(const Variables &sub_model_vars, const Variables &recast_vars, const Response &sub_model_response, Response &recast_response)  secondary_resp_map 
)
void derived_compute_response ( const ActiveSet set) [protected, virtual]

portion of compute_response() specific to RecastModel (forward to subModel.compute_response())

The RecastModel is evaluated by an Iterator for a recast problem formulation. Therefore, the currentVariables, incoming active set, and output currentResponse all correspond to the recast inputs/outputs.

Reimplemented from Model.

References Response::active_set(), Model::compute_response(), Model::current_response(), Model::current_variables(), Model::currentResponse, Model::currentVariables, RecastModel::respMapping, RecastModel::subModel, RecastModel::transform_response(), RecastModel::transform_set(), RecastModel::transform_variables(), and Response::update().

void eval_tag_prefix ( const String &  eval_id_str) [inline, protected, virtual]

set the hierarchical eval ID tag prefix

RecastModel just forwards any tags to its subModel

Reimplemented from Model.

References Model::eval_tag_prefix(), and RecastModel::subModel.

void update_from_sub_model ( ) [private]

update current variables/labels/bounds/targets from subModel

Update inactive values and labels in currentVariables and inactive bound constraints in userDefinedConstraints from variables and constraints data within subModel.

References Model::aleatDistParams, Model::aleatory_distribution_parameters(), Constraints::continuous_lower_bounds(), Model::continuous_lower_bounds(), Constraints::continuous_upper_bounds(), Model::continuous_upper_bounds(), Variables::continuous_variable_labels(), Model::continuous_variable_labels(), Variables::continuous_variables(), Model::continuous_variables(), Model::currentResponse, Model::currentVariables, Model::discrete_design_set_int_values(), Model::discrete_design_set_real_values(), Constraints::discrete_int_lower_bounds(), Model::discrete_int_lower_bounds(), Constraints::discrete_int_upper_bounds(), Model::discrete_int_upper_bounds(), Variables::discrete_int_variable_labels(), Model::discrete_int_variable_labels(), Variables::discrete_int_variables(), Model::discrete_int_variables(), Constraints::discrete_real_lower_bounds(), Model::discrete_real_lower_bounds(), Constraints::discrete_real_upper_bounds(), Model::discrete_real_upper_bounds(), Variables::discrete_real_variable_labels(), Model::discrete_real_variable_labels(), Variables::discrete_real_variables(), Model::discrete_real_variables(), Model::discrete_state_set_int_values(), Model::discrete_state_set_real_values(), Model::discreteDesignSetIntValues, Model::discreteDesignSetRealValues, Model::discreteStateSetIntValues, Model::discreteStateSetRealValues, Model::epistDistParams, Model::epistemic_distribution_parameters(), SharedResponseData::function_label(), Constraints::inactive_continuous_lower_bounds(), Model::inactive_continuous_lower_bounds(), Constraints::inactive_continuous_upper_bounds(), Model::inactive_continuous_upper_bounds(), Variables::inactive_continuous_variable_labels(), Model::inactive_continuous_variable_labels(), Variables::inactive_continuous_variables(), Model::inactive_continuous_variables(), Constraints::inactive_discrete_int_lower_bounds(), Model::inactive_discrete_int_lower_bounds(), Constraints::inactive_discrete_int_upper_bounds(), Model::inactive_discrete_int_upper_bounds(), Variables::inactive_discrete_int_variable_labels(), Model::inactive_discrete_int_variable_labels(), Variables::inactive_discrete_int_variables(), Model::inactive_discrete_int_variables(), Constraints::inactive_discrete_real_lower_bounds(), Model::inactive_discrete_real_lower_bounds(), Constraints::inactive_discrete_real_upper_bounds(), Model::inactive_discrete_real_upper_bounds(), Variables::inactive_discrete_real_variable_labels(), Model::inactive_discrete_real_variable_labels(), Variables::inactive_discrete_real_variables(), Model::inactive_discrete_real_variables(), Constraints::linear_eq_constraint_coeffs(), Model::linear_eq_constraint_coeffs(), Constraints::linear_eq_constraint_targets(), Model::linear_eq_constraint_targets(), Constraints::linear_ineq_constraint_coeffs(), Model::linear_ineq_constraint_coeffs(), Constraints::linear_ineq_constraint_lower_bounds(), Model::linear_ineq_constraint_lower_bounds(), Constraints::linear_ineq_constraint_upper_bounds(), Model::linear_ineq_constraint_upper_bounds(), Constraints::nonlinear_eq_constraint_targets(), Model::nonlinear_eq_constraint_targets(), Constraints::nonlinear_ineq_constraint_lower_bounds(), Model::nonlinear_ineq_constraint_lower_bounds(), Constraints::nonlinear_ineq_constraint_upper_bounds(), Model::nonlinear_ineq_constraint_upper_bounds(), Model::num_functions(), Model::num_linear_eq_constraints(), Model::num_linear_ineq_constraints(), Constraints::num_nonlinear_eq_constraints(), Model::num_nonlinear_eq_constraints(), Constraints::num_nonlinear_ineq_constraints(), Model::num_nonlinear_ineq_constraints(), Model::numFns, Model::primary_response_fn_sense(), Model::primary_response_fn_weights(), Model::primaryRespFnSense, Model::primaryRespFnWts, RecastModel::primaryRespMapping, Model::response_labels(), RecastModel::secondaryRespMapping, Response::shared_data(), RecastModel::subModel, Model::userDefinedConstraints, and RecastModel::variablesMapping.

Referenced by RecastModel::update_from_subordinate_model().


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