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

Derived model class which performs a complete sub-iterator execution within every evaluation of the model. More...

Inheritance diagram for NestedModel:
Model

List of all members.

Public Member Functions

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

Protected Member Functions

void derived_compute_response (const ActiveSet &set)
 portion of compute_response() specific to NestedModel
void derived_asynch_compute_response (const ActiveSet &set)
 portion of asynch_compute_response() specific to NestedModel
const IntResponseMap & derived_synchronize ()
 portion of synchronize() specific to NestedModel
Iteratorsubordinate_iterator ()
 return subIterator
Modelsubordinate_model ()
 return subModel
void derived_subordinate_models (ModelList &ml, bool recurse_flag)
 return subModel
Interfacederived_interface ()
 return optionalInterface
void surrogate_response_mode (short mode)
 pass a bypass request on to the subModel for any lower-level surrogates
void component_parallel_mode (short mode)
 update component parallel mode for supporting parallelism in optionalInterface and subModel
size_t mi_parallel_level_index () const
 return subIteratorSched.miPLIndex
short local_eval_synchronization ()
 return optionalInterface synchronization setting
int local_eval_concurrency ()
 return optionalInterface asynchronous evaluation concurrency
bool derived_master_overload () const
 flag which prevents overloading the master with a multiprocessor evaluation (forwarded to optionalInterface)
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 optionalInterface and subModel for parallel operations
void derived_init_serial ()
 set up optionalInterface and subModel for serial operations.
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 NestedModel (forwarded to optionalInterface and subModel)
void serve_run (ParLevLIter pl_iter, int max_eval_concurrency)
 Service optionalInterface and 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 server operations for subModel and optionalInterface when iteration on the NestedModel is complete.
const String & interface_id () const
 return the optionalInterface identifier
int evaluation_id () const
 Return the current evaluation id for the NestedModel.
void set_evaluation_reference ()
 set the evaluation counter reference points for the NestedModel (request forwarded to optionalInterface and subModel)
void fine_grained_evaluation_counters ()
 request fine-grained evaluation reporting within optionalInterface and subModel
void print_evaluation_summary (std::ostream &s, bool minimal_header=false, bool relative_count=true) const
 print the evaluation summary for the NestedModel (request forwarded to optionalInterface and subModel)
void eval_tag_prefix (const String &eval_id_str)
 set the hierarchical eval ID tag prefix
void initialize_iterator (int job_index)
void pack_parameters_buffer (MPIPackBuffer &send_buffer, int job_index)
void unpack_parameters_buffer (MPIUnpackBuffer &recv_buffer)
void unpack_parameters_initialize (MPIUnpackBuffer &recv_buffer)
void pack_results_buffer (MPIPackBuffer &send_buffer, int job_index)
void unpack_results_buffer (MPIUnpackBuffer &recv_buffer, int job_index)
void update_local_results (int job_index)

Private Member Functions

void update_sub_iterator ()
 update subIterator with mapping data and set subIterator-based counts
void initialize_iterator (const Variables &vars, const ActiveSet &set, int eval_id)
 lower level function shared by initialize_iterator(int) and unpack_parameters_initialize()
void unpack (MPIUnpackBuffer &recv_buffer, Variables &vars, ActiveSet &set, int &eval_id)
 lower level function shared by unpack_parameters_buffer() and unpack_parameters_initialize()
void resolve_real_variable_mapping (const String &map1, const String &map2, size_t curr_index, short &inactive_sm_view)
 for a named real mapping, resolve primary index and secondary target
void resolve_integer_variable_mapping (const String &map1, const String &map2, size_t curr_index, short &inactive_sm_view)
 for a named integer mapping, resolve primary index and secondary target
void resolve_string_variable_mapping (const String &map1, const String &map2, size_t curr_index, short &inactive_sm_view)
 for a named string mapping, resolve primary index and secondary target
size_t sm_acv_index_map (size_t pacvm_index, short sacvm_target)
 offset pacvm_index based on sacvm_target to create mapped_index
size_t sm_adiv_index_map (size_t padivm_index, short sadivm_target)
 offset padivm_index based on sadivm_target to create mapped_index
size_t sm_adsv_index_map (size_t padsvm_index, short sadsvm_target)
 offset padsvm_index based on sadsvm_target to create mapped_index
size_t sm_adrv_index_map (size_t padrvm_index, short sadrvm_target)
 offset padrvm_index based on sadrvm_target to create mapped_index
size_t cv_index_map (size_t cv_index, const Variables &vars)
 offset cv_index to create index into aggregated primary/secondary arrays
size_t div_index_map (size_t div_index, const Variables &vars)
 offset div_index to create index into aggregated primary/secondary arrays
size_t dsv_index_map (size_t dsv_index, const Variables &vars)
 offset dsv_index to create index into aggregated primary/secondary arrays
size_t drv_index_map (size_t drv_index, const Variables &vars)
 offset drv_index to create index into aggregated primary/secondary arrays
size_t ccv_index_map (size_t ccv_index, const Variables &vars)
 offset active complement ccv_index to create index into all continuous arrays
size_t cdiv_index_map (size_t cdiv_index, const Variables &vars)
 offset active complement cdiv_index to create index into all discrete int arrays
size_t cdsv_index_map (size_t cdsv_index, const Variables &vars)
 offset active complement cdsv_index to create index into all discrete string arrays
size_t cdrv_index_map (size_t cdrv_index, const Variables &vars)
 offset active complement cdrv_index to create index into all discrete real arrays
void real_variable_mapping (const Real &r_var, size_t mapped_index, short svm_target)
 insert r_var into appropriate recipient
void integer_variable_mapping (const int &i_var, size_t mapped_index, short svm_target)
 insert i_var into appropriate recipient
void string_variable_mapping (const String &s_var, size_t mapped_index, short svm_target)
 insert s_var into appropriate recipient
void set_mapping (const ActiveSet &mapped_set, ActiveSet &interface_set, bool &opt_interface_map, ActiveSet &sub_iterator_set, bool &sub_iterator_map)
 define the evaluation requirements for the optionalInterface (interface_set) and the subIterator (sub_iterator_set) from the total model evaluation requirements (mapped_set)
void response_mapping (const Response &interface_response, const Response &sub_iterator_response, Response &mapped_response)
 combine the response from the optional interface evaluation with the response from the sub-iteration using the primaryCoeffs/secondaryCoeffs mappings to create the total response for the model
void interface_response_overlay (const Response &opt_interface_response, Response &mapped_response)
 assign the response from the optional interface evaluation within the total response for the model
void iterator_response_overlay (const Response &sub_iterator_response, Response &mapped_response)
 overlay the sub-iteration response within the total response for the model using the primaryCoeffs/secondaryCoeffs mappings
Responsefind_nested_response (int nested_cntr)
 locate existing or allocate new entry in nestedResponseMap
void check_response_map (const ShortArray &mapped_asv)
 check function counts for the mapped_asv
void update_inactive_view (short new_view, short &view)
 update inactive variables view for subIterator based on new_view
void update_inactive_view (unsigned short type, short &view)
 update inactive variables view for subIterator based on type
void update_sub_model (const Variables &vars, const Constraints &cons)
 update subModel with current variable values/bounds/labels

Private Attributes

int nestedModelEvalCntr
 number of calls to derived_compute_response()/ derived_asynch_compute_response()
bool firstUpdate
 boolean to trigger one-time updates on first call to update_sub_model()
IntResponseMap nestedResponseMap
 used to return a map of nested responses (including subIterator and optionalInterface contributions) for aggregation and rekeying at the base class level
size_t outerMIPLIndex
 the miPLIndex for the outer parallelism context, prior to any subIterator partitioning
Iterator subIterator
 the sub-iterator that is executed on every evaluation of this model
String subMethodPointer
 the sub-method pointer from the nested model specification
Model subModel
 the sub-model used in sub-iterator evaluations
PRPQueue subIteratorPRPQueue
 job queue for asynchronous execution of subIterator jobs
IteratorScheduler subIteratorSched
 scheduling object for concurrent iterator parallelism
int subIteratorJobCntr
 subIterator job counter since last synchronize()
IntIntMap subIteratorIdMap
 mapping from subIterator evaluation counter to nested model counter (different when subIterator evaluations do not occur on every nested model evaluation due to variable ASV content)
size_t numSubIterFns
 number of sub-iterator response functions prior to mapping
size_t numSubIterMappedIneqCon
 number of top-level inequality constraints mapped from the sub-iteration results
size_t numSubIterMappedEqCon
 number of top-level equality constraints mapped from the sub-iteration results
Interface optionalInterface
 the optional interface contributes nonnested response data to the total model response
String optInterfacePointer
 the optional interface pointer from the nested model specification
Response optInterfaceResponse
 the response object resulting from optional interface evaluations
IntIntMap optInterfaceIdMap
 mapping from optionalInterface evaluation counter to nested model counter (different when optionalInterface evaluations do not occur on every nested model evaluation due to variable ASV content)
size_t numOptInterfPrimary
 number of primary response functions (objective/least squares/generic functions) resulting from optional interface evaluations
size_t numOptInterfIneqCon
 number of inequality constraints resulting from optional interface evaluations
size_t numOptInterfEqCon
 number of equality constraints resulting from the optional interface evaluations
SizetArray active1ACVarMapIndices
 "primary" variable mappings for inserting active continuous currentVariables within all continuous subModel variables. If there are no secondary mappings defined, then the insertions replace the subModel variable values.
SizetArray active1ADIVarMapIndices
 "primary" variable mappings for inserting active discrete int currentVariables within all discrete int subModel variables. No secondary mappings are defined for discrete int variables, so the active variables replace the subModel variable values.
SizetArray active1ADSVarMapIndices
 "primary" variable mappings for inserting active discrete string currentVariables within all discrete string subModel variables. No secondary mappings are defined for discrete string variables, so the active variables replace the subModel variable values.
SizetArray active1ADRVarMapIndices
 "primary" variable mappings for inserting active discrete real currentVariables within all discrete real subModel variables. No secondary mappings are defined for discrete real variables, so the active variables replace the subModel variable values.
ShortArray active2ACVarMapTargets
 "secondary" variable mappings for inserting active continuous currentVariables into sub-parameters (e.g., distribution parameters for uncertain variables or bounds for continuous design/state variables) within all continuous subModel variables.
ShortArray active2ADIVarMapTargets
 "secondary" variable mappings for inserting active discrete int currentVariables into sub-parameters (e.g., bounds for discrete design/state variables) within all discrete int subModel variables.
ShortArray active2ADSVarMapTargets
 "secondary" variable mappings for inserting active discrete string currentVariables into sub-parameters (e.g., bounds for discrete design/state variables) within all discrete string subModel variables.
ShortArray active2ADRVarMapTargets
 "secondary" variable mappings for inserting active discrete real currentVariables into sub-parameters (e.g., bounds for discrete design/state variables) within all discrete real subModel variables.
SizetArray complement1ACVarMapIndices
 "primary" variable mappings for inserting the complement of the active continuous currentVariables within all continuous subModel variables
SizetArray complement1ADIVarMapIndices
 "primary" variable mappings for inserting the complement of the active discrete int currentVariables within all discrete int subModel variables
SizetArray complement1ADSVarMapIndices
 "primary" variable mappings for inserting the complement of the active discrete string currentVariables within all discrete string subModel variables
SizetArray complement1ADRVarMapIndices
 "primary" variable mappings for inserting the complement of the active discrete real currentVariables within all discrete real subModel variables
BitArray extraCVarsData
 flags for updating subModel continuous bounds and labels, one for each active continuous variable in currentVariables
BitArray extraDIVarsData
 flags for updating subModel discrete int bounds and labels, one for each active discrete int variable in currentVariables
BitArray extraDSVarsData
 flags for updating subModel discrete string labels, one for each active discrete string variable in currentVariables
BitArray extraDRVarsData
 flags for updating subModel discrete real bounds and labels, one for each active discrete real variable in currentVariables
RealMatrix primaryRespCoeffs
 "primary" response_mapping matrix applied to the sub-iterator response functions. For OUU, the matrix is applied to UQ statistics to create contributions to the top-level objective functions/least squares/ generic response terms.
RealMatrix secondaryRespCoeffs
 "secondary" response_mapping matrix applied to the sub-iterator response functions. For OUU, the matrix is applied to UQ statistics to create contributions to the top-level inequality and equality constraints.
String evalTagPrefix
 cached evalTag Prefix from parents to use at compute_response time

Friends

class IteratorScheduler
 protect scheduler callback functions from general access

Detailed Description

Derived model class which performs a complete sub-iterator execution within every evaluation of the model.

The NestedModel class nests a sub-iterator execution within every model evaluation. This capability is most commonly used for optimization under uncertainty, in which a nondeterministic iterator is executed on every optimization function evaluation. The NestedModel also contains an optional interface, for portions of the model evaluation which are independent from the sub-iterator, and a set of mappings for combining sub-iterator and optional interface data into a top level response for the model.


Member Function Documentation

void derived_compute_response ( const ActiveSet set) [protected, virtual]
void derived_asynch_compute_response ( const ActiveSet set) [protected, virtual]
const IntResponseMap & derived_synchronize ( ) [protected, virtual]
short local_eval_synchronization ( ) [inline, protected, virtual]

return optionalInterface synchronization setting

Used in setting Model::asynchEvalFlag. subModel synchronization is used for setting asynchEvalFlag within subModel.

Reimplemented from Model.

References Interface::asynch_local_evaluation_concurrency(), Interface::interface_synchronization(), NestedModel::optInterfacePointer, and NestedModel::optionalInterface.

int local_eval_concurrency ( ) [inline, protected, virtual]

return optionalInterface asynchronous evaluation concurrency

Used in setting Model::evaluationCapacity. subModel concurrency is used for setting evaluationCapacity within subModel.

Reimplemented from Model.

References Interface::asynch_local_evaluation_concurrency(), NestedModel::optInterfacePointer, and NestedModel::optionalInterface.

bool derived_master_overload ( ) const [inline, protected, virtual]

flag which prevents overloading the master with a multiprocessor evaluation (forwarded to optionalInterface)

Derived master overload for subModel is handled separately in subModel.compute_response() within subIterator.run().

Reimplemented from Model.

References Iterator::is_null(), Interface::iterator_eval_dedicated_master(), IteratorScheduler::iteratorScheduling, Interface::multi_proc_eval(), NestedModel::optInterfacePointer, NestedModel::optionalInterface, IteratorScheduler::procsPerIterator, NestedModel::subIterator, and NestedModel::subIteratorSched.

void derived_init_communicators ( ParLevLIter  pl_iter,
int  max_eval_concurrency,
bool  recurse_flag = true 
) [protected, virtual]
int evaluation_id ( ) const [inline, protected, virtual]

Return the current evaluation id for the NestedModel.

return the top level nested evaluation count. To get the lower level eval count, the subModel must be explicitly queried. This is consistent with the eval counter definitions in surrogate models.

Reimplemented from Model.

References NestedModel::nestedModelEvalCntr.

size_t cv_index_map ( size_t  cv_index,
const Variables vars 
) [private]

offset cv_index to create index into aggregated primary/secondary arrays

maps index within active continuous variables to index within aggregated active continuous/discrete-int/discrete-string/discrete-real variables.

References SharedVariablesData::aleatory_uncertain_counts(), SharedVariablesData::design_counts(), SharedVariablesData::epistemic_uncertain_counts(), Variables::shared_data(), and SharedVariablesData::view().

Referenced by NestedModel::NestedModel(), and NestedModel::update_sub_model().

size_t div_index_map ( size_t  div_index,
const Variables vars 
) [private]

offset div_index to create index into aggregated primary/secondary arrays

maps index within active discrete int variables to index within aggregated active continuous/discrete-int/discrete-string/discrete-real variables.

References SharedVariablesData::aleatory_uncertain_counts(), Variables::cv(), SharedVariablesData::design_counts(), SharedVariablesData::epistemic_uncertain_counts(), Variables::shared_data(), SharedVariablesData::state_counts(), and SharedVariablesData::view().

Referenced by NestedModel::NestedModel(), and NestedModel::update_sub_model().

size_t dsv_index_map ( size_t  dsv_index,
const Variables vars 
) [private]

offset dsv_index to create index into aggregated primary/secondary arrays

maps index within active discrete string variables to index within aggregated active continuous/discrete-int/discrete-string/discrete-string variables.

References SharedVariablesData::aleatory_uncertain_counts(), Variables::cv(), SharedVariablesData::design_counts(), Variables::div(), SharedVariablesData::epistemic_uncertain_counts(), Variables::shared_data(), SharedVariablesData::state_counts(), and SharedVariablesData::view().

Referenced by NestedModel::NestedModel(), and NestedModel::update_sub_model().

size_t drv_index_map ( size_t  drv_index,
const Variables vars 
) [private]

offset drv_index to create index into aggregated primary/secondary arrays

maps index within active discrete real variables to index within aggregated active continuous/discrete-int/discrete-string/discrete-real variables.

References SharedVariablesData::aleatory_uncertain_counts(), Variables::cv(), SharedVariablesData::design_counts(), Variables::div(), Variables::dsv(), SharedVariablesData::epistemic_uncertain_counts(), Variables::shared_data(), SharedVariablesData::state_counts(), and SharedVariablesData::view().

Referenced by NestedModel::NestedModel(), and NestedModel::update_sub_model().

size_t ccv_index_map ( size_t  ccv_index,
const Variables vars 
) [private]

offset active complement ccv_index to create index into all continuous arrays

maps index within complement of active continuous variables to index within all continuous variables.

References Dakota::abort_handler(), SharedVariablesData::aleatory_uncertain_counts(), SharedVariablesData::design_counts(), SharedVariablesData::epistemic_uncertain_counts(), Variables::shared_data(), and SharedVariablesData::view().

Referenced by NestedModel::NestedModel(), and NestedModel::update_sub_model().

size_t cdiv_index_map ( size_t  cdiv_index,
const Variables vars 
) [private]

offset active complement cdiv_index to create index into all discrete int arrays

maps index within complement of active discrete int variables to index within all discrete int variables.

References Dakota::abort_handler(), SharedVariablesData::aleatory_uncertain_counts(), SharedVariablesData::design_counts(), SharedVariablesData::epistemic_uncertain_counts(), Variables::shared_data(), and SharedVariablesData::view().

Referenced by NestedModel::NestedModel(), and NestedModel::update_sub_model().

size_t cdsv_index_map ( size_t  cdsv_index,
const Variables vars 
) [private]

offset active complement cdsv_index to create index into all discrete string arrays

maps index within complement of active discrete string variables to index within all discrete string variables.

References Dakota::abort_handler(), SharedVariablesData::aleatory_uncertain_counts(), SharedVariablesData::design_counts(), SharedVariablesData::epistemic_uncertain_counts(), Variables::shared_data(), and SharedVariablesData::view().

Referenced by NestedModel::NestedModel(), and NestedModel::update_sub_model().

size_t cdrv_index_map ( size_t  cdrv_index,
const Variables vars 
) [private]

offset active complement cdrv_index to create index into all discrete real arrays

maps index within complement of active discrete real variables to index within all discrete real variables.

References Dakota::abort_handler(), SharedVariablesData::aleatory_uncertain_counts(), SharedVariablesData::design_counts(), SharedVariablesData::epistemic_uncertain_counts(), Variables::shared_data(), and SharedVariablesData::view().

Referenced by NestedModel::NestedModel(), and NestedModel::update_sub_model().

void response_mapping ( const Response opt_interface_response,
const Response sub_iterator_response,
Response mapped_response 
) [inline, private]

combine the response from the optional interface evaluation with the response from the sub-iteration using the primaryCoeffs/secondaryCoeffs mappings to create the total response for the model

In the OUU case,

optionalInterface fns = {f}, {g} (deterministic primary functions, constraints)
subIterator fns       = {S}      (UQ response statistics)

Problem formulation for mapped functions:
                  minimize    {f} + [W]{S}
                  subject to  {g_l} <= {g}    <= {g_u}
                              {a_l} <= [A]{S} <= {a_u}
                              {g}    == {g_t}
                              [A]{S} == {a_t}

where [W] is the primary_mapping_matrix user input (primaryRespCoeffs class attribute), [A] is the secondary_mapping_matrix user input (secondaryRespCoeffs class attribute), {{g_l},{a_l}} are the top level inequality constraint lower bounds, {{g_u},{a_u}} are the top level inequality constraint upper bounds, and {{g_t},{a_t}} are the top level equality constraint targets.

NOTE: optionalInterface/subIterator primary fns (obj/lsq/generic fns) overlap but optionalInterface/subIterator secondary fns (ineq/eq constraints) do not. The [W] matrix can be specified so as to allow

  • some purely deterministic primary functions and some combined: [W] filled and [W].num_rows() < {f}.length() [combined first] or [W].num_rows() == {f}.length() and [W] contains rows of zeros [combined last]
  • some combined and some purely stochastic primary functions: [W] filled and [W].num_rows() > {f}.length()
  • separate deterministic and stochastic primary functions: [W].num_rows() > {f}.length() and [W] contains {f}.length() rows of zeros.

If the need arises, could change constraint definition to allow overlap as well: {g_l} <= {g} + [A]{S} <= {g_u} with [A] usage the same as for [W] above.

In the UOO case, things are simpler, just compute statistics of each optimization response function: [W] = [I], {f}/{g}/[A] are empty.

References Response::active_set_request_vector(), NestedModel::check_response_map(), NestedModel::interface_response_overlay(), and NestedModel::iterator_response_overlay().


Member Data Documentation

Model subModel [private]

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