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 (Model &sub_model, const Sizet2DArray &vars_map_indices, bool nonlinear_vars_mapping, void(*variables_map)(const Variables &recast_vars, Variables &sub_model_vars), void(*set_map)(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 (Model &sub_model, 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 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 submodel_supports_estimated_derivatives (bool ssed_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
Interfaceinterface ()
 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)
 forward to subModel
void surrogate_bypass (bool bypass_flag)
 deactivate/reactivate the approximations for any/all surrogate models contained within this model
void build_approximation ()
 builds the subModel approximation
bool build_approximation (const Variables &vars, const Response &response)
 builds the subModel approximation
void update_approximation (bool rebuild_flag)
 replaces data in the subModel approximation
void update_approximation (const Variables &vars, const Response &response, bool rebuild_flag)
 replaces data in the subModel approximation
void update_approximation (const VariablesArray &vars_array, const ResponseArray &resp_array, 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 Response &response, bool rebuild_flag)
 appends data to the subModel approximation
void append_approximation (const VariablesArray &vars_array, const ResponseArray &resp_array, bool rebuild_flag)
 appends data to the subModel approximation
void pop_approximation (bool save_sdp_set)
 remove the previous data set addition to a surrogate (e.g., due to a previous append_approximation() call); flag manages saving of SurrogateDataPoint set for use in 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
std::vector< Approximation > & approximations ()
 retrieve the set of Approximations from the subModel
const RealVectorArray & approximation_coefficients ()
 retrieve the approximation coefficients from the subModel
void approximation_coefficients (const RealVectorArray &approx_coeffs)
 set the approximation coefficients within the subModel
const RealVector & approximation_variances (const RealVector &c_vars)
 retrieve the approximation variances from the subModel
const SDPList & 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.
String 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)
void derived_init_communicators (const int &max_iterator_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 (const int &max_iterator_concurrency, bool recurse_flag=true)
 set active parallel configuration within subModel
void derived_free_communicators (const int &max_iterator_concurrency, bool recurse_flag=true)
 deallocate communicator partitions for the RecastModel (request forwarded to subModel)
void serve ()
 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 Stringinterface_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)

Private Member Functions

void set_mapping (const ActiveSet &recast_set, ActiveSet &sub_model_set)
 Uses recastFnMap to convert incoming recast_set from iterator into sub_model_set for use with 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)
bool nonlinearVarsMapping
 boolean set to true if the variables mapping involves a nonlinear transformation. Used in set_mapping() 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 set_mapping() 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 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

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 ( Model sub_model,
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.

References Model::central_hess(), Model::centralHess, Model::componentParallelMode, Constraints::copy(), Response::copy(), Variables::copy(), Model::current_response(), Model::current_variables(), Model::currentResponse, Model::currentVariables, Variables::cv(), Model::fd_gradient_step_size(), Model::fd_hessian_by_fn_step_size(), Model::fd_hessian_by_grad_step_size(), Model::fdGradSS, Model::fdHessByFnSS, Model::fdHessByGradSS, Response::function_gradients(), Response::function_hessians(), Model::gradIdAnalytic, Model::gradIdNumerical, Model::gradient_id_analytic(), Model::gradient_id_numerical(), Model::gradient_type(), Model::gradType, Model::hessian_id_analytic(), Model::hessian_id_numerical(), Model::hessian_id_quasi(), Model::hessian_type(), Model::hessIdAnalytic, Model::hessIdNumerical, Model::hessIdQuasi, Model::hessType, Model::ignore_bounds(), Model::ignoreBounds, Model::interval_type(), Model::intervalType, Model::method_source(), Model::methodSrc, 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, Model::output_level(), Model::outputLevel, Model::quasi_hessian_type(), Model::quasiHessType, Constraints::reshape(), Response::reshape(), RecastModel::subModel, Model::user_defined_constraints(), and Model::userDefinedConstraints.


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 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 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::continuous_lower_bounds(), Constraints::continuous_lower_bounds(), Model::continuous_upper_bounds(), Constraints::continuous_upper_bounds(), Model::continuous_variable_labels(), Variables::continuous_variable_labels(), Model::continuous_variables(), Variables::continuous_variables(), Model::currentResponse, Model::currentVariables, Model::discrete_design_set_int_values(), Model::discrete_design_set_real_values(), Model::discrete_int_lower_bounds(), Constraints::discrete_int_lower_bounds(), Model::discrete_int_upper_bounds(), Constraints::discrete_int_upper_bounds(), Model::discrete_int_variable_labels(), Variables::discrete_int_variable_labels(), Model::discrete_int_variables(), Variables::discrete_int_variables(), Model::discrete_real_lower_bounds(), Constraints::discrete_real_lower_bounds(), Model::discrete_real_upper_bounds(), Constraints::discrete_real_upper_bounds(), Model::discrete_real_variable_labels(), Variables::discrete_real_variable_labels(), Model::discrete_real_variables(), Variables::discrete_real_variables(), Model::discrete_state_set_int_values(), Model::discrete_state_set_real_values(), Model::discreteDesignSetIntValues, Model::discreteDesignSetRealValues, Model::discreteStateSetIntValues, Model::discreteStateSetRealValues, Model::distParams, Model::distribution_parameters(), Response::function_label(), Model::inactive_continuous_lower_bounds(), Constraints::inactive_continuous_lower_bounds(), Model::inactive_continuous_upper_bounds(), Constraints::inactive_continuous_upper_bounds(), Model::inactive_continuous_variable_labels(), Variables::inactive_continuous_variable_labels(), Model::inactive_continuous_variables(), Variables::inactive_continuous_variables(), Model::inactive_discrete_int_lower_bounds(), Constraints::inactive_discrete_int_lower_bounds(), Model::inactive_discrete_int_upper_bounds(), Constraints::inactive_discrete_int_upper_bounds(), Model::inactive_discrete_int_variable_labels(), Variables::inactive_discrete_int_variable_labels(), Model::inactive_discrete_int_variables(), Variables::inactive_discrete_int_variables(), Model::inactive_discrete_real_lower_bounds(), Constraints::inactive_discrete_real_lower_bounds(), Model::inactive_discrete_real_upper_bounds(), Constraints::inactive_discrete_real_upper_bounds(), Model::inactive_discrete_real_variable_labels(), Variables::inactive_discrete_real_variable_labels(), Model::inactive_discrete_real_variables(), Variables::inactive_discrete_real_variables(), Model::linear_eq_constraint_coeffs(), Constraints::linear_eq_constraint_coeffs(), Model::linear_eq_constraint_targets(), Constraints::linear_eq_constraint_targets(), Model::linear_ineq_constraint_coeffs(), Constraints::linear_ineq_constraint_coeffs(), Model::linear_ineq_constraint_lower_bounds(), Constraints::linear_ineq_constraint_lower_bounds(), Model::linear_ineq_constraint_upper_bounds(), Constraints::linear_ineq_constraint_upper_bounds(), Model::nonlinear_eq_constraint_targets(), Constraints::nonlinear_eq_constraint_targets(), Model::nonlinear_ineq_constraint_lower_bounds(), Constraints::nonlinear_ineq_constraint_lower_bounds(), Model::nonlinear_ineq_constraint_upper_bounds(), Constraints::nonlinear_ineq_constraint_upper_bounds(), Model::num_functions(), Model::num_linear_eq_constraints(), Model::num_linear_ineq_constraints(), Model::num_nonlinear_eq_constraints(), Constraints::num_nonlinear_eq_constraints(), Model::num_nonlinear_ineq_constraints(), Constraints::num_nonlinear_ineq_constraints(), Model::numFns, Model::primary_response_fn_weights(), Model::primaryRespFnWts, RecastModel::primaryRespMapping, Model::response_labels(), RecastModel::secondaryRespMapping, 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: