Dakota
Version 6.21
Explore and Predict with Confidence
|
Derived class within the interface class hierarchy for supporting approximations to simulation-based results. More...
Public Member Functions | |
ApproximationInterface (ProblemDescDB &problem_db, const Variables &am_vars, bool am_cache, const String &am_interface_id, const StringArray &fn_labels) | |
primary constructor | |
ApproximationInterface (const String &approx_type, const UShortArray &approx_order, const Variables &am_vars, bool am_cache, const String &am_interface_id, size_t num_fns, short data_order, short output_level) | |
alternate constructor for instantiations on the fly | |
~ApproximationInterface () | |
destructor | |
Public Member Functions inherited from Interface | |
Interface () | |
default constructor More... | |
Interface (ProblemDescDB &problem_db) | |
standard constructor for envelope More... | |
Interface (const Interface &interface_in) | |
copy constructor More... | |
virtual | ~Interface () |
destructor | |
Interface | operator= (const Interface &interface_in) |
assignment operator | |
virtual void | serve_evaluations () |
evaluation server function for multiprocessor executions | |
virtual void | stop_evaluation_servers () |
send messages from iterator rank 0 to terminate evaluation servers | |
virtual void | init_communicators (const IntArray &message_lengths, int max_eval_concurrency) |
allocate communicator partitions for concurrent evaluations within an iterator and concurrent multiprocessor analyses within an evaluation. | |
virtual void | set_communicators (const IntArray &message_lengths, int max_eval_concurrency) |
set the local parallel partition data for an interface (the partitions are already allocated in ParallelLibrary). | |
virtual void | init_serial () |
reset certain defaults for serial interface objects. | |
virtual int | asynch_local_evaluation_concurrency () const |
return the user-specified concurrency for asynch local evaluations | |
virtual short | interface_synchronization () const |
return the user-specified interface synchronization | |
virtual RealArray | challenge_diagnostics (const String &metric_type, const RealMatrix &challenge_pts) |
approximation challenge data metrics per response function | |
virtual const StringArray & | analysis_drivers () const |
retrieve the analysis drivers specification for application interfaces | |
virtual const String2DArray & | analysis_components () const |
retrieve the analysis components, if available | |
virtual bool | evaluation_cache () const |
return flag indicating usage of the global evaluation cache | |
virtual bool | restart_file () const |
return flag indicating usage of the restart file | |
virtual void | file_cleanup () const |
clean up any interface parameter/response files when aborting | |
IntResponseMap & | response_map () |
return rawResponseMap | |
void | cache_unmatched_response (int raw_id) |
migrate an unmatched response record from rawResponseMap to cachedResponseMap | |
void | cache_unmatched_responses () |
migrate all remaining response records from rawResponseMap to cachedResponseMap | |
void | assign_rep (std::shared_ptr< Interface > interface_rep) |
assign letter or replace existing letter with a new one More... | |
void | assign_rep (Interface *interface_rep, bool ref_count_incr=false) |
assign letter or replace existing letter with a new one DEPRECATED, but left for library mode clients to migrate: transfers memory ownership to the contained shared_ptr; ref_count_incr is ignored More... | |
unsigned short | interface_type () const |
returns the interface type | |
const String & | interface_id () const |
returns the interface identifier | |
int | evaluation_id () const |
returns the value of the (total) evaluation id counter for the interface | |
void | fine_grained_evaluation_counters (size_t num_fns) |
set fineGrainEvalCounters to true and initialize counters if needed | |
void | init_evaluation_counters (size_t num_fns) |
initialize fine grained evaluation counters, sizing if needed | |
void | set_evaluation_reference () |
set evaluation count reference points for the interface | |
void | print_evaluation_summary (std::ostream &s, bool minimal_header, bool relative_count) const |
print an evaluation summary for the interface | |
bool | multi_proc_eval () const |
returns a flag signaling the use of multiprocessor evaluation partitions | |
bool | iterator_eval_dedicated_master () const |
returns a flag signaling the use of a dedicated master processor at the iterator-evaluation scheduling level | |
bool | is_null () const |
function to check interfaceRep (does this envelope contain a letter?) | |
std::shared_ptr< Interface > | interface_rep () |
function to return the letter | |
void | eval_tag_prefix (const String &eval_id_str, bool append_iface_id=true) |
set the evaluation tag prefix (does not recurse) More... | |
Protected Member Functions | |
virtual Approximation & | function_surface (size_t) |
return reference to specified approximation | |
virtual const Approximation & | function_surface (size_t) const |
virtual int | field_component (size_t fn_index) const |
return surface field component for response index | |
virtual size_t | num_function_surfaces () const |
void | map (const Variables &vars, const ActiveSet &set, Response &response, bool asynch_flag=false) |
the function evaluator: provides an approximate "mapping" from the variables to the responses using functionSurfaces | |
int | minimum_points (bool constraint_flag) const |
returns the minimum number of samples required to build the functionSurfaces | |
int | recommended_points (bool constraint_flag) const |
returns the recommended number of samples recommended to build the functionSurfaces | |
void | active_model_key (const Pecos::ActiveKey &key) |
activate an approximation state based on its key | |
void | clear_model_keys () |
reset initial state by removing all model keys for an approximation | |
void | approximation_function_indices (const SizetSet &approx_fn_indices) |
set the (currently active) approximation function index set | |
void | update_approximation (const Variables &vars, const IntResponsePair &response_pr) |
void | update_approximation (const RealMatrix &samples, const IntResponseMap &resp_map) |
void | update_approximation (const VariablesArray &vars_array, const IntResponseMap &resp_map) |
void | append_approximation (const Variables &vars, const IntResponsePair &response_pr) |
void | append_approximation (const RealMatrix &samples, const IntResponseMap &resp_map) |
void | append_approximation (const VariablesArray &vars_array, const IntResponseMap &resp_map) |
void | append_approximation (const IntVariablesMap &vars_map, const IntResponseMap &resp_map) |
void | replace_approximation (const IntResponsePair &response_pr) |
replace the response for a single point within an existing approximation | |
void | replace_approximation (const IntResponseMap &resp_map) |
replace responses for multiple points within an existing approximation | |
void | track_evaluation_ids (bool track) |
assigns trackEvalIds to activate tracking of evaluation ids within surrogate data, enabling id-based lookups for data replacement | |
void | build_approximation (const RealVector &c_l_bnds, const RealVector &c_u_bnds, const IntVector &di_l_bnds, const IntVector &di_u_bnds, const RealVector &dr_l_bnds, const RealVector &dr_u_bnds) |
void | export_approximation () |
void | rebuild_approximation (const BitArray &rebuild_fns) |
void | pop_approximation (bool save_data) |
void | push_approximation () |
bool | push_available () |
queries the approximation for the ability to retrieve a previous increment | |
void | finalize_approximation () |
finalizes the approximation by applying all trial increments | |
void | combine_approximation () |
combine the current approximation with previously stored data sets | |
void | combined_to_active (bool clear_combined=true) |
promote the combined approximation to the currently active one | |
void | clear_inactive () |
clear inactive approximation data | |
void | clear_current_active_data () |
clears current data from an approximation interface | |
void | clear_active_data () |
clears all data from an approximation interface | |
SharedApproxData & | shared_approximation () |
retrieve the SharedApproxData within an ApproximationInterface | |
const SizetSet & | approximation_fn_indices () const |
std::vector< Approximation > & | approximations () |
retrieve the Approximations within an ApproximationInterface | |
const Pecos::SurrogateData & | approximation_data (size_t fn_index) |
retrieve the approximation data from a particular Approximation within an ApproximationInterface | |
const RealVectorArray & | approximation_coefficients (bool normalized=false) |
retrieve the approximation coefficients from each Approximation within an ApproximationInterface | |
void | approximation_coefficients (const RealVectorArray &approx_coeffs, bool normalized=false) |
set the approximation coefficients within each Approximation within an ApproximationInterface | |
const RealVector & | approximation_variances (const Variables &vars) |
retrieve the approximation variances from each Approximation within an ApproximationInterface | |
void | discrepancy_emulation_mode (short mode) |
set discrepancy emulation mode used for approximating response differences | |
bool | formulation_updated () const |
query for change in approximation formulation | |
void | formulation_updated (bool update) |
assign an updated status for approximation formulation to force rebuild | |
bool | advancement_available () |
query for available advancements in approximation resolution controls | |
Real2DArray | cv_diagnostics (const StringArray &metrics, unsigned num_folds) |
approximation cross-validation quality metrics per response function | |
Real2DArray | challenge_diagnostics (const StringArray &metric_types, const RealMatrix &challenge_pts, const RealVector &challenge_resps) |
const IntResponseMap & | synchronize () |
recovers data from a series of asynchronous evaluations (blocking) | |
const IntResponseMap & | synchronize_nowait () |
recovers data from a series of asynchronous evaluations (nonblocking) | |
Protected Member Functions inherited from Interface | |
Interface (BaseConstructor, const ProblemDescDB &problem_db) | |
constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139) More... | |
Interface (NoDBBaseConstructor, size_t num_fns, short output_level) | |
constructor initializes the base class part of letter classes (NoDBBaseConstructor used for on the fly instantiations without a DB) | |
void | init_algebraic_mappings (const Variables &vars, const Response &response) |
Define algebraicACVIndices, algebraicACVIds, and algebraicFnIndices. | |
void | asv_mapping (const ActiveSet &total_set, ActiveSet &algebraic_set, ActiveSet &core_set) |
define the evaluation requirements for algebraic_mappings() (algebraic_set) and the core Application/Approximation mapping (core_set) from the total Interface evaluation requirements (total_set) | |
void | asv_mapping (const ActiveSet &algebraic_set, ActiveSet &total_set) |
map an algebraic ASV back to original total ordering for asynch recovery | |
void | algebraic_mappings (const Variables &vars, const ActiveSet &algebraic_set, Response &algebraic_response) |
evaluate the algebraic_response using the AMPL solver library and the data extracted from the algebraic_mappings file | |
void | response_mapping (const Response &algebraic_response, const Response &core_response, Response &total_response) |
combine the response from algebraic_mappings() with the response from derived_map() to create the total response More... | |
virtual String | final_eval_id_tag (int fn_eval_id) |
form and return the final evaluation ID tag, appending iface ID if needed | |
Protected Attributes | |
std::vector< Approximation > | functionSurfaces |
list of approximations, one per response function More... | |
Protected Attributes inherited from Interface | |
unsigned short | interfaceType |
the interface type: enum for system, fork, direct, grid, or approximation | |
String | interfaceId |
the interface specification identifier string from the DAKOTA input file | |
bool | algebraicMappings |
flag for the presence of algebraic_mappings that define the subset of an Interface's parameter to response mapping that is explicit and algebraic. | |
bool | coreMappings |
flag for the presence of non-algebraic mappings that define the core of an Interface's parameter to response mapping (using analysis_drivers for ApplicationInterface or functionSurfaces for ApproximationInterface). | |
short | outputLevel |
output verbosity level: {SILENT,QUIET,NORMAL,VERBOSE,DEBUG}_OUTPUT | |
int | currEvalId |
identifier for the current evaluation, which may differ from the evaluation counters in the case of evaluation scheduling; used on iterator master as well as server processors. Currently, this is set prior to all invocations of derived_map() for all processors. | |
bool | fineGrainEvalCounters |
controls use of fn val/grad/hess counters for detailed evaluation report | |
int | evalIdCntr |
total interface evaluation counter | |
int | newEvalIdCntr |
new (non-duplicate) interface evaluation counter | |
int | evalIdRefPt |
iteration reference point for evalIdCntr | |
int | newEvalIdRefPt |
iteration reference point for newEvalIdCntr | |
IntArray | fnValCounter |
number of value evaluations by resp fn | |
IntArray | fnGradCounter |
number of gradient evaluations by resp fn | |
IntArray | fnHessCounter |
number of Hessian evaluations by resp fn | |
IntArray | newFnValCounter |
number of new value evaluations by resp fn | |
IntArray | newFnGradCounter |
number of new gradient evaluations by resp fn | |
IntArray | newFnHessCounter |
number of new Hessian evaluations by resp fn | |
IntArray | fnValRefPt |
iteration reference point for fnValCounter | |
IntArray | fnGradRefPt |
iteration reference point for fnGradCounter | |
IntArray | fnHessRefPt |
iteration reference point for fnHessCounter | |
IntArray | newFnValRefPt |
iteration reference point for newFnValCounter | |
IntArray | newFnGradRefPt |
iteration reference point for newFnGradCounter | |
IntArray | newFnHessRefPt |
iteration reference point for newFnHessCounter | |
IntResponseMap | rawResponseMap |
Set of responses returned by either a blocking or nonblocking schedule. More... | |
IntResponseMap | cachedResponseMap |
Set of available asynchronous responses completed within a blocking or nonblocking scheduler that cannot be processed in a higher level context and need to be stored for later. | |
StringArray | fnLabels |
response function descriptors (used in print_evaluation_summary() and derived direct interface classes); initialized in map() functions due to potential updates after construction | |
bool | multiProcEvalFlag |
flag for multiprocessor evaluation partitions (evalComm) | |
bool | ieDedMasterFlag |
flag for dedicated master partitioning at the iterator level | |
String | evalTagPrefix |
set of period-delimited evaluation ID tags to use in evaluation tagging | |
bool | appendIfaceId |
whether to append the interface ID to the prefix during map (default true) | |
String2DArray | analysisComponents |
Analysis components for interface types that support them. | |
Private Member Functions | |
void | mixed_add (const Variables &vars, const IntResponsePair &response_pr, bool anchor) |
add variables/response data to functionSurfaces using a mixture of shallow and deep copies | |
void | mixed_add (const Real *c_vars, const IntResponsePair &response_pr, bool anchor) |
add variables/response data to functionSurfaces using a mixture of shallow and deep copies | |
void | shallow_add (const Variables &vars, const IntResponsePair &response_pr, bool anchor) |
add variables/response data to functionSurfaces using a shallow copy | |
void | sample_to_variables (const Real *sample_c_vars, size_t num_cv, Variables &vars) |
populate continuous variables within vars from sample_c_vars | |
void | update_pop_counts (const IntResponsePair &response_pr) |
append to the stack of pop counts within each of the functionSurfaces based on the active set definition within a single incoming response | |
void | update_pop_counts (const IntResponseMap &resp_map) |
append to the stack of pop counts within each of the functionSurfaces based on the active set definitions within a map of incoming responses | |
PRPCacheCIter | cache_lookup (const Variables &vars, int eval_id, const Response &response) |
helper to find a cached PRP record in data_pairs | |
PRPCacheCIter | cache_lookup (const Real *vars, size_t num_v, int eval_id, const Response &response) |
helper to find a cached PRP record in data_pairs | |
void | check_id (int id1, int id2) |
verify consistency between two evaluation identifiers | |
void | restore_data_key () |
following Approximation::add() and Approximation::pop_count() operations, which may enumerate multiple embedded keys, restore the active approxData to the nominal key More... | |
void | check_singleton_key_index (size_t index) |
check on valid indices for singleton active keys | |
void | qoi_set_to_key_index (size_t qoi_set, size_t &key_index) |
for aggregate active keys that input a single set of data, some mapping from QoI sets to key indices may be required | |
void | read_challenge_points () |
Load approximation test points from user challenge points file. More... | |
Private Attributes | |
SizetSet | approxFnIndices |
for incomplete approximation sets, this array specifies the response function subset that is approximated | |
SharedApproxData | sharedData |
data that is shared among all functionSurfaces | |
RealVectorArray | functionSurfaceCoeffs |
array of approximation coefficient vectors, one per response function | |
RealVector | functionSurfaceVariances |
vector of approximation variances, one value per response function | |
bool | trackEvalIds |
flag to activate the tracking of evaluation ids within surrogate data | |
String | challengeFile |
data file for user-supplied challenge data (per interface, since may contain multiple responses) | |
unsigned short | challengeFormat |
tabular format of the challenge points file | |
bool | challengeUseVarLabels |
whether to validate variable labels in header | |
bool | challengeActiveOnly |
whether to import active only | |
RealMatrix | challengePoints |
container for the challenge points data (variables only) | |
RealMatrix | challengeResponses |
container for the challenge points data (responses only) | |
Variables | actualModelVars |
copy of the actualModel variables object used to simplify conversion among differing variable views | |
bool | actualModelCache |
indicates usage of an evaluation cache by the actualModel | |
String | actualModelInterfaceId |
the interface id from the actualModel used for ordered PRPCache lookups | |
IntResponseMap | beforeSynchResponseMap |
bookkeeping map to catalogue responses generated in map() for use in synchronize() and synchronize_nowait(). This supports pseudo-asynchronous operations (approximate responses are always computed synchronously, but asynchronous virtual functions are supported through bookkeeping). | |
Static Private Attributes | |
static size_t | approxIdNum = 0 |
counter for giving unique names to approximation interfaces | |
Derived class within the interface class hierarchy for supporting approximations to simulation-based results.
ApproximationInterface provides an interface class for building a set of global/local/multipoint approximations and performing approximate function evaluations using them. It contains a list of Approximation objects, one for each response function.
|
protectedvirtual |
This function populates/replaces each Approximation::anchorPoint with the incoming variables/response data point.
Reimplemented from Interface.
References ApproximationInterface::actualModelCache, ApproximationInterface::cache_lookup(), Dakota::data_pairs, ApproximationInterface::mixed_add(), ApproximationInterface::restore_data_key(), and ApproximationInterface::shallow_add().
|
protectedvirtual |
This function populates/replaces each Approximation::currentPoints with the incoming variables/response arrays.
Reimplemented from Interface.
References Dakota::abort_handler(), ApproximationInterface::actualModelCache, ApproximationInterface::approxFnIndices, ApproximationInterface::cache_lookup(), Approximation::clear_active_data(), Dakota::data_pairs, ApproximationInterface::function_surface(), ApproximationInterface::mixed_add(), ApproximationInterface::restore_data_key(), and ApproximationInterface::shallow_add().
|
protectedvirtual |
This function populates/replaces each Approximation::currentPoints with the incoming variables/response arrays.
Reimplemented from Interface.
References Dakota::abort_handler(), ApproximationInterface::actualModelCache, ApproximationInterface::approxFnIndices, ApproximationInterface::cache_lookup(), Approximation::clear_active_data(), Dakota::data_pairs, ApproximationInterface::function_surface(), ApproximationInterface::mixed_add(), ApproximationInterface::restore_data_key(), and ApproximationInterface::shallow_add().
|
protectedvirtual |
This function appends to each Approximation::currentPoints with one incoming variables/response data point.
Reimplemented from Interface.
References ApproximationInterface::actualModelCache, ApproximationInterface::cache_lookup(), Dakota::data_pairs, ApproximationInterface::mixed_add(), ApproximationInterface::restore_data_key(), ApproximationInterface::shallow_add(), and ApproximationInterface::update_pop_counts().
|
protectedvirtual |
This function appends to each Approximation::currentPoints with multiple incoming variables/response data points.
Reimplemented from Interface.
References Dakota::abort_handler(), ApproximationInterface::actualModelCache, ApproximationInterface::cache_lookup(), Dakota::data_pairs, ApproximationInterface::mixed_add(), ApproximationInterface::restore_data_key(), ApproximationInterface::shallow_add(), and ApproximationInterface::update_pop_counts().
|
protectedvirtual |
This function appends to each Approximation::currentPoints with multiple incoming variables/response data points.
Reimplemented from Interface.
References Dakota::abort_handler(), ApproximationInterface::actualModelCache, ApproximationInterface::cache_lookup(), Dakota::data_pairs, ApproximationInterface::mixed_add(), ApproximationInterface::restore_data_key(), ApproximationInterface::shallow_add(), and ApproximationInterface::update_pop_counts().
|
protectedvirtual |
This function appends to each Approximation::currentPoints with multiple incoming variables/response data points.
Reimplemented from Interface.
References Dakota::abort_handler(), ApproximationInterface::actualModelCache, ApproximationInterface::cache_lookup(), ApproximationInterface::check_id(), Dakota::data_pairs, ApproximationInterface::mixed_add(), ApproximationInterface::restore_data_key(), ApproximationInterface::shallow_add(), and ApproximationInterface::update_pop_counts().
|
protectedvirtual |
This function finds the coefficients for each Approximation based on the data passed through update_approximation() calls. The bounds are used only for graphics visualization.
Reimplemented from Interface.
References ApproximationInterface::approxFnIndices, Approximation::build(), SharedApproxData::build(), Approximation::challenge_diagnostics(), ApproximationInterface::challengeFile, ApproximationInterface::challengePoints, ApproximationInterface::challengeResponses, ApproximationInterface::function_surface(), Approximation::primary_diagnostics(), ApproximationInterface::read_challenge_points(), SharedApproxData::set_bounds(), and ApproximationInterface::sharedData.
|
protectedvirtual |
This function calls export on each approximation
Reimplemented from Interface.
References ApproximationInterface::approxFnIndices, Approximation::export_model(), and ApproximationInterface::function_surface().
|
protectedvirtual |
This function updates the coefficients for each Approximation based on data increments provided by {update,append}_approximation().
Reimplemented from Interface.
References ApproximationInterface::approxFnIndices, ApproximationInterface::function_surface(), Approximation::rebuild(), SharedApproxData::rebuild(), and ApproximationInterface::sharedData.
|
inlineprotectedvirtual |
This function removes data provided by a previous append_approximation() call, possibly different numbers for each function, or as specified in pop_count, which is assumed to be the same for all functions.
Reimplemented from Interface.
References ApproximationInterface::approxFnIndices, ApproximationInterface::function_surface(), SharedApproxData::pop(), Approximation::pop_coefficients(), Approximation::pop_data(), and ApproximationInterface::sharedData.
|
inlineprotectedvirtual |
This function updates the coefficients for each Approximation based on data increments provided by {update,append}_approximation().
Reimplemented from Interface.
References ApproximationInterface::approxFnIndices, ApproximationInterface::function_surface(), SharedApproxData::post_push(), SharedApproxData::pre_push(), Approximation::push_coefficients(), Approximation::push_data(), and ApproximationInterface::sharedData.
|
inlineprivate |
following Approximation::add() and Approximation::pop_count() operations, which may enumerate multiple embedded keys, restore the active approxData to the nominal key
Restore active key in approxData using shared key.
References SharedApproxData::active_model_key(), Approximation::active_model_key(), ApproximationInterface::approxFnIndices, ApproximationInterface::function_surface(), ApproximationInterface::sharedData, and Approximation::surrogate_data().
Referenced by ApproximationInterface::append_approximation(), and ApproximationInterface::update_approximation().
|
private |
Load approximation test points from user challenge points file.
Challenge data defaults to active/inactive, but user can override to active only.
References ApproximationInterface::actualModelVars, ApproximationInterface::challengeActiveOnly, ApproximationInterface::challengeFile, ApproximationInterface::challengeFormat, ApproximationInterface::challengePoints, ApproximationInterface::challengeResponses, ApproximationInterface::challengeUseVarLabels, Variables::copy(), Interface::interface_id(), and Interface::outputLevel.
Referenced by ApproximationInterface::build_approximation().
|
protected |
list of approximations, one per response function
This formulation allows the use of mixed approximations (i.e., different approximations used for different response functions), although the input specification is not currently general enough to support it.
Referenced by ApproximationFieldInterface::ApproximationFieldInterface(), ApproximationInterface::ApproximationInterface(), ApproximationInterface::approximations(), ApproximationInterface::function_surface(), and ApproximationFieldInterface::function_surface().