Dakota  Version 6.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
SurfpackApproximation Class Reference

Derived approximation class for Surfpack approximation classes. Interface between Surfpack and Dakota. More...

Inheritance diagram for SurfpackApproximation:
Approximation

Public Member Functions

 SurfpackApproximation ()
 default constructor
 
 SurfpackApproximation (const ProblemDescDB &problem_db, const SharedApproxData &shared_data, const String &approx_label)
 standard constructor: Surfpack surface of appropriate type will be created More...
 
 SurfpackApproximation (const SharedApproxData &shared_data)
 alternate constructor More...
 
 ~SurfpackApproximation ()
 destructor
 
- Public Member Functions inherited from Approximation
 Approximation ()
 default constructor More...
 
 Approximation (ProblemDescDB &problem_db, const SharedApproxData &shared_data, const String &approx_label)
 standard constructor for envelope More...
 
 Approximation (const SharedApproxData &shared_data)
 alternate constructor More...
 
 Approximation (const Approximation &approx)
 copy constructor More...
 
virtual ~Approximation ()
 destructor More...
 
Approximation operator= (const Approximation &approx)
 assignment operator More...
 
virtual void rebuild ()
 rebuilds the approximation incrementally More...
 
virtual void pop (bool save_data)
 removes entries from end of SurrogateData::{vars,resp}Data (last points appended, or as specified in args) More...
 
virtual void push ()
 restores state prior to previous pop() More...
 
virtual void finalize ()
 finalize approximation by applying all remaining trial sets More...
 
virtual void store (size_t index=_NPOS)
 store current approximation state for later combination
 
virtual void restore (size_t index=_NPOS)
 restore previous approximation state
 
virtual void remove_stored (size_t index=_NPOS)
 remove a stored approximation prior to combination
 
virtual void combine (short corr_type, size_t swap_index)
 combine current approximation with previously stored approximation
 
virtual RealVector approximation_coefficients (bool normalized) const
 return the coefficient array computed by build()/rebuild()
 
virtual void approximation_coefficients (const RealVector &approx_coeffs, bool normalized)
 set the coefficient array from external sources, rather than computing with build()/rebuild()
 
virtual void coefficient_labels (std::vector< std::string > &coeff_labels) const
 print the coefficient array computed in build()/rebuild()
 
virtual void print_coefficients (std::ostream &s, bool normalized)
 print the coefficient array computed in build()/rebuild()
 
virtual int num_constraints () const
 return the number of constraints to be enforced via an anchor point
 
virtual void clear_current ()
 clear current build data in preparation for next build More...
 
int min_points (bool constraint_flag) const
 return the minimum number of points required to build the approximation type in numVars dimensions. Uses *_coefficients() and num_constraints().
 
int recommended_points (bool constraint_flag) const
 return the recommended number of samples to build the approximation type in numVars dimensions (default same as min_points)
 
const Pecos::SurrogateData & approximation_data () const
 return approxData
 
void add (const Pecos::SurrogateDataVars &sdv, bool anchor_flag)
 append to SurrogateData::varsData or assign to SurrogateData::anchorVars
 
void add (const Variables &vars, bool anchor_flag, bool deep_copy)
 extract the relevant vectors from Variables and invoke add(RealVector&, IntVector&, RealVector&)
 
void add (const Real *sample_c_vars, bool anchor_flag, bool deep_copy)
 create a RealVector view and invoke add(RealVector&, empty, empty)
 
void add (const RealVector &c_vars, const IntVector &di_vars, const RealVector &dr_vars, bool anchor_flag, bool deep_copy)
 shared code among add(Variables&) and add(Real*); adds a new data point by either appending to SurrogateData::varsData or assigning to SurrogateData::anchorVars, as dictated by anchor_flag. Uses add_point() and add_anchor().
 
void add (const Pecos::SurrogateDataResp &sdr, bool anchor_flag)
 append to SurrogateData::respData or assign to SurrogateData::anchorResp
 
void add (const Response &response, int fn_index, bool anchor_flag, bool deep_copy)
 adds a new data point by either appending to SurrogateData::respData or assigning to SurrogateData::anchorResp, as dictated by anchor_flag. Uses add_point() and add_anchor().
 
void add (const RealMatrix &sample_vars, const RealVector &sample_resp)
 add data from the provided samples and response matrices, assuming continuous variables and function values only
 
void pop_count (size_t count)
 appends to popCountStack (number of entries to pop from end of SurrogateData::{vars,resp}Data, based on size of last data set appended)
 
void clear_all ()
 clear all build data (current and history) to restore original state More...
 
void clear_anchor ()
 clear SurrogateData::anchor{Vars,Resp}
 
void clear_data ()
 clear SurrogateData::{vars,resp}Data
 
void clear_popped ()
 clear popCountStack and SurrogateData::popped{Vars,Resp}Trials
 
void set_bounds (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)
 set approximation lower and upper bounds (currently only used by graphics)
 
Approximationapprox_rep () const
 returns approxRep for access to derived class member functions that are not mapped to the top Approximation level
 

Protected Member Functions

int min_coefficients () const
 return the minimum number of samples (unknowns) required to build the derived class approximation type in numVars dimensions
 
int recommended_coefficients () const
 return the recommended number of samples (unknowns) required to build the derived class approximation type in numVars dimensions
 
void build ()
 SurfData object will be created from Dakota's SurrogateData, and the appropriate Surfpack build method will be invoked. More...
 
void export_model (const String &fn_label, const String &export_prefix="", const unsigned short export_format=NO_MODEL_FORMAT)
 export the Surpack model to disk or console
 
Real value (const Variables &vars)
 Return the value of the Surfpack surface for a given parameter vector x.
 
const RealVector & gradient (const Variables &vars)
 retrieve the approximate function gradient for a given parameter vector x
 
const RealSymMatrix & hessian (const Variables &vars)
 retrieve the approximate function Hessian for a given parameter vector x More...
 
Real prediction_variance (const Variables &vars)
 retrieve the variance of the predicted value for a given parameter set x (KrigingModel only)
 
Real value (const RealVector &c_vars)
 Return the value of the Surfpack surface for a given parameter vector x.
 
const RealVector & gradient (const RealVector &c_vars)
 retrieve the approximate function gradient for a given parameter vector x
 
const RealSymMatrix & hessian (const RealVector &c_vars)
 retrieve the approximate function Hessian for a given parameter vector x More...
 
Real prediction_variance (const RealVector &c_vars)
 retrieve the variance of the predicted value for a given parameter set x (KrigingModel only)
 
bool diagnostics_available ()
 check if the diagnostics are available (true for the Surfpack types)
 
Real diagnostic (const String &metric_type)
 retrieve a single diagnostic metric for the diagnostic type specified on the primary model and data
 
Real diagnostic (const String &metric_type, const SurfpackModel &model, const SurfData &data)
 retrieve a single diagnostic metric for the diagnostic type specified on the given model and data
 
void primary_diagnostics (int fn_index)
 compute and print all requested diagnostics and cross-validation
 
void challenge_diagnostics (const RealMatrix &challenge_points, const RealVector &challenge_responses)
 compute and print all requested diagnostics for user provided challenge pts
 
RealArray cv_diagnostic (const StringArray &metric_types, unsigned num_folds)
 compute and return cross-validation for metric_type with num_folds
 
RealArray challenge_diagnostic (const StringArray &metric_types, const RealMatrix &challenge_points, const RealVector &challenge_responses)
 compute and print all requested diagnostics for user provided challenge pts
 
- Protected Member Functions inherited from Approximation
 Approximation (BaseConstructor, const ProblemDescDB &problem_db, const SharedApproxData &shared_data, const String &approx_label)
 constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139) More...
 
 Approximation (NoDBBaseConstructor, const SharedApproxData &shared_data)
 constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139) More...
 

Private Member Functions

SurfData * surrogates_to_surf_data ()
 copy from SurrogateData to SurfPoint/SurfData More...
 
void add_anchor_to_surfdata (SurfData &surf_data)
 set the anchor point (including gradient and hessian if present) into surf_data More...
 

Private Attributes

SurfpackModel * model
 The native Surfpack approximation.
 
SurfpackModelFactory * factory
 factory for the SurfpackModel instance
 
SurfData * surfData
 The data used to build the approximation, in Surfpack format.
 

Additional Inherited Members

- Protected Attributes inherited from Approximation
RealVector approxGradient
 gradient of the approximation returned by gradient()
 
RealSymMatrix approxHessian
 Hessian of the approximation returned by hessian()
 
Pecos::SurrogateData approxData
 contains the variables/response data for constructing a single approximation model (one response function)
 
SharedApproxDatasharedDataRep
 contains the approximation data that is shared among the response set
 
String approxLabel
 label for approximation, if applicable
 

Detailed Description

Derived approximation class for Surfpack approximation classes. Interface between Surfpack and Dakota.

The SurfpackApproximation class is the interface between Dakota and Surfpack. Based on the information in the ProblemDescDB that is passed in through the constructor, SurfpackApproximation builds a Surfpack Surface object that corresponds to one of the following data-fitting techniques: polynomial regression, kriging, artificial neural networks, radial basis function network, or multivariate adaptaive regression splines (MARS).

Constructor & Destructor Documentation

SurfpackApproximation ( const ProblemDescDB problem_db,
const SharedApproxData shared_data,
const String &  approx_label 
)
SurfpackApproximation ( const SharedApproxData shared_data)

Member Function Documentation

void build ( )
protectedvirtual

SurfData object will be created from Dakota's SurrogateData, and the appropriate Surfpack build method will be invoked.

surfData will be deleted in dtor

Todo:
Right now, we're completely deleting the old data and then recopying the current data into a SurfData object. This was just the easiest way to arrive at a solution that would build and run. This function is frequently called from addPoint rebuild, however, and it's not good to go through this whole process every time one more data point is added.

Reimplemented from Approximation.

References Dakota::abort_handler(), SharedApproxData::approxCLowerBnds, SharedApproxData::approxCUpperBnds, SharedApproxData::approxDILowerBnds, SharedApproxData::approxDIUpperBnds, SharedApproxData::approxDRLowerBnds, SharedApproxData::approxDRUpperBnds, Approximation::build(), SurfpackApproximation::factory, SharedSurfpackApproxData::merge_variable_arrays(), SurfpackApproximation::model, Approximation::sharedDataRep, SurfpackApproximation::surfData, and SurfpackApproximation::surrogates_to_surf_data().

const RealSymMatrix & hessian ( const Variables vars)
protectedvirtual

retrieve the approximate function Hessian for a given parameter vector x

Todo:
Make this acceptably efficient

Reimplemented from Approximation.

References Dakota::abort_handler(), Approximation::approxHessian, SharedApproxData::approxType, Variables::cv(), SurfpackApproximation::model, and Approximation::sharedDataRep.

Referenced by SurfpackApproximation::add_anchor_to_surfdata().

const RealSymMatrix & hessian ( const RealVector &  c_vars)
protectedvirtual

retrieve the approximate function Hessian for a given parameter vector x

Todo:
Make this acceptably efficient

Reimplemented from Approximation.

References Dakota::abort_handler(), Approximation::approxHessian, SharedApproxData::approxType, SurfpackApproximation::model, and Approximation::sharedDataRep.

SurfData * surrogates_to_surf_data ( )
private

copy from SurrogateData to SurfPoint/SurfData

Copy the data stored in Dakota-style SurrogateData into Surfpack-style SurfPoint and SurfData objects.

References SurfpackApproximation::add_anchor_to_surfdata(), SharedSurfpackApproxData::add_sd_to_surfdata(), Approximation::approxData, SharedApproxData::buildDataOrder, SurfpackApproximation::factory, SharedApproxData::outputLevel, and Approximation::sharedDataRep.

Referenced by SurfpackApproximation::build().

void add_anchor_to_surfdata ( SurfData &  surf_data)
private

set the anchor point (including gradient and hessian if present) into surf_data

If there is an anchor point, add an equality constraint for its response value. Also add constraints for gradient and hessian, if applicable.

References Dakota::abort_handler(), Approximation::approxData, Dakota::copy_data(), SharedSurfpackApproxData::copy_matrix(), SurfpackApproximation::gradient(), SurfpackApproximation::hessian(), SharedApproxData::outputLevel, SharedSurfpackApproxData::sdv_to_realarray(), and Approximation::sharedDataRep.

Referenced by SurfpackApproximation::surrogates_to_surf_data().


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