Dakota  Version
Explore and Predict with Confidence
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ParamResponsePair Class Reference

Container class for a variables object, a response object, and an evaluation id. More...

Public Member Functions

 ParamResponsePair ()
 default constructor
 
 ParamResponsePair (const Variables &vars, const String &interface_id, const Response &response, bool deep_copy=false)
 alternate constructor for temporaries More...
 
 ParamResponsePair (const Variables &vars, const String &interface_id, const Response &response, const int eval_id, bool deep_copy=true)
 standard constructor for history uses More...
 
 ParamResponsePair (const ParamResponsePair &pair)
 copy constructor
 
 ~ParamResponsePair ()
 destructor
 
ParamResponsePairoperator= (const ParamResponsePair &pair)
 assignment operator
 
void read (std::istream &s)
 read a ParamResponsePair object from an std::istream
 
void write (std::ostream &s) const
 write a ParamResponsePair object to an std::ostream
 
void read_annotated (std::istream &s)
 read a ParamResponsePair object in annotated format from an std::istream
 
void write_annotated (std::ostream &s) const
 write a ParamResponsePair object in annotated format to an std::ostream
 
void write_tabular (std::ostream &s, unsigned short tabular_format) const
 write a ParamResponsePair object in tabular format (all variables active/inactive) to an std::ostream
 
void write_tabular_labels (std::ostream &s, unsigned short tabular_format) const
 write PRP labels in tabular format to an std::ostream
 
void read (MPIUnpackBuffer &s)
 read a ParamResponsePair object from a packed MPI buffer More...
 
void write (MPIPackBuffer &s) const
 write a ParamResponsePair object to a packed MPI buffer More...
 
int eval_id () const
 return the evaluation identifier
 
void eval_id (int id)
 set the evaluation identifier
 
const String & interface_id () const
 return the interface identifier from evalInterfaceIds
 
void interface_id (const String &id)
 set the interface identifier within evalInterfaceIds
 
const IntStringPair & eval_interface_ids () const
 return the aggregate eval/interface identifier from the response object
 
const Variablesvariables () const
 return the parameters object
 
Variablesvariables ()
 return the parameters object
 
void variables (const Variables &vars)
 set the parameters object
 
const Responseresponse () const
 return the response object
 
Responseresponse ()
 return the response object
 
void response (const Response &resp)
 set the response object
 
IntResponsePair response_pair () const
 return evaluation id and response as a std::pair
 
const ActiveSetactive_set () const
 return the active set object from the response object
 
void active_set (const ActiveSet &set)
 set the active set object within the response object
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 serialize the PRP: write and read are symmetric for this class
 

Private Attributes

Variables prpVariables
 the set of parameters for the function evaluation
 
Response prpResponse
 the response set for the function evaluation
 
IntStringPair evalInterfaceIds
 the evalInterfaceIds aggregate More...
 

Friends

class boost::serialization::access
 allow boost access to serialize this class
 
bool operator== (const ParamResponsePair &pair1, const ParamResponsePair &pair2)
 equality operator
 
bool operator!= (const ParamResponsePair &pair1, const ParamResponsePair &pair2)
 inequality operator
 

Detailed Description

Container class for a variables object, a response object, and an evaluation id.

ParamResponsePair provides a container class for association of the input for a particular function evaluation (a variables object) with the output from this function evaluation (a response object), along with an evaluation identifier. This container defines the basic unit used in the data_pairs cache, in restart file operations, and in a variety of scheduling algorithm queues. With the advent of STL, replacement of arrays of this class with map<> and pair<> template constructs may be possible (using map<pair<int,String>, pair<Variables,Response> >, for example), assuming that deep copies, I/O, alternate constructors, etc., can be adequately addressed. Boost tuple<> may also be a candidate.

Constructor & Destructor Documentation

◆ ParamResponsePair() [1/2]

ParamResponsePair ( const Variables vars,
const String &  interface_id,
const Response response,
bool  deep_copy = false 
)
inline

alternate constructor for temporaries

Uses of this constructor often employ the standard Variables and Response copy constructors to share representations since this constructor is commonly used for search_pairs (which are local instantiations that go out of scope prior to any changes to values; i.e., they are not used for history).

◆ ParamResponsePair() [2/2]

ParamResponsePair ( const Variables vars,
const String &  interface_id,
const Response response,
const int  eval_id,
bool  deep_copy = true 
)
inline

standard constructor for history uses

Uses of this constructor often do not share representations since deep copies are used when history mechanisms (e.g., data_pairs and beforeSynchCorePRPQueue) are involved.

Member Function Documentation

◆ read()

void read ( MPIUnpackBuffer s)
inline

read a ParamResponsePair object from a packed MPI buffer

interfaceId is omitted since master processor retains interface ids and communicates asv and response data only with slaves.

References ParamResponsePair::evalInterfaceIds, ParamResponsePair::prpResponse, and ParamResponsePair::prpVariables.

◆ write()

void write ( MPIPackBuffer s) const
inline

write a ParamResponsePair object to a packed MPI buffer

interfaceId is omitted since master processor retains interface ids and communicates asv and response data only with slaves.

References ParamResponsePair::evalInterfaceIds, ParamResponsePair::prpResponse, and ParamResponsePair::prpVariables.

Member Data Documentation

◆ evalInterfaceIds

IntStringPair evalInterfaceIds
private

the evalInterfaceIds aggregate

the function evaluation identifier (assigned from Interface::evalIdCntr) is paired with the interface used to generate the response object. Used in PRPCache id_vars_set_compare to prevent duplicate detection on results from different interfaces. evalInterfaceIds belongs here rather than in Response since some Response objects involve consolidation of several fn evals (e.g., Model::synchronize_derivatives()) that are not, in total, generated by a single interface. The prPair, on the other hand, is used for storage of all low level fn evals that get evaluated in ApplicationInterface::map().

Referenced by ParamResponsePair::eval_id(), ParamResponsePair::eval_interface_ids(), ParamResponsePair::interface_id(), ParamResponsePair::operator=(), Dakota::operator==(), ParamResponsePair::read(), ParamResponsePair::response_pair(), and ParamResponsePair::write().


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