Dakota  Version 6.21
Explore and Predict with Confidence
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
VPSApproximation Class Reference

Derived approximation class for VPS implementation. More...

Inheritance diagram for VPSApproximation:
Approximation

Public Member Functions

 VPSApproximation ()
 default constructor
 
 VPSApproximation (const ProblemDescDB &problem_db, const SharedApproxData &shared_data, const String &approx_label)
 standard constructor (to call VPS from an input deck)
 
 VPSApproximation (const SharedApproxData &shared_data)
 Alternate constructor (to call VPS from another method like POF-darts)
 
 ~VPSApproximation ()
 destructor
 
bool VPS_execute ()
 
void VPS_create_containers ()
 
void VPS_retrieve_neighbors (size_t ipoint, bool update_point_neighbors)
 
void VPS_adjust_extend_neighbors_of_all_points ()
 
void VPS_extend_neighbors (size_t ipoint)
 
void VPS_build_local_surrogate (size_t cell_index)
 
double VPS_evaluate_surrogate (double *x)
 
void VPS_destroy_global_containers ()
 
void retrieve_permutations (size_t &m, size_t **&perm, size_t num_dim, size_t upper_bound, bool force_sum_constraint, size_t sum_constraint)
 
void build_radial_basis_function (size_t icell)
 
void VPS_LS_retrieve_weights (size_t cell_index)
 
double evaluate_basis_function (double *x, size_t icell, size_t ibasis)
 
int constrained_LeastSquare (size_t n, size_t m, double **H, double *w, double *f)
 
double vec_dot_vec (size_t n, double *vec_a, double *vec_b)
 
double vec_pow_vec (size_t num_dim, double *vec_a, size_t *vec_b)
 
bool Cholesky (int n, double **A, double **LD)
 
void Cholesky_solver (int n, double **LD, double *b, double *x)
 
void GMRES (size_t n, double **A, double *b, double *x, double eps)
 
void printMatrix (size_t m, size_t n, double **M)
 
void initiate_random_number_generator (unsigned long x)
 
double generate_a_random_number ()
 
size_t retrieve_closest_cell (double *x)
 
bool trim_line_using_Hyperplane (size_t num_dim, double *st, double *end, double *qH, double *nH)
 
double f_test (double *x)
 
double * grad_f_test (double *x)
 
double ** hessian_f_test (double *x)
 
void generate_poisson_disk_sample (double r)
 
void generate_MC_sample ()
 
void isocontouring (std::string file_name, bool plot_test_function, bool plot_surrogate, std::vector< double > contours)
 
void isocontouring_solid (std::string file_name, bool plot_test_function, bool plot_surrogate, std::vector< double > contours)
 
void plot_neighbors ()
 
- 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
 
Approximation operator= (const Approximation &approx)
 assignment operator
 
virtual void active_model_key (const Pecos::ActiveKey &sd_key)
 activate an approximation state based on its multi-index key
 
virtual void clear_model_keys ()
 reset initial state by removing all model keys for an approximation
 
virtual void build (int num_resp)
 overloaded build to support field-based approximations; builds from scratch More...
 
virtual void export_model (const StringArray &var_labels=StringArray(), const String &fn_label="", const String &export_prefix="", const unsigned short export_format=NO_MODEL_FORMAT)
 exports the approximation; if export_format > NO_MODEL_FORMAT, uses all 3 parameters, otherwise extracts these from the Approximation's sharedDataRep to build a filename
 
virtual void export_model (const Variables &vars, const String &fn_label="", const String &export_prefix="", const unsigned short export_format=NO_MODEL_FORMAT)
 approximation export that generates labels from the passed Variables, since only the derived classes know how the variables are ordered w.r.t. the surrogate build; if export_format > NO_MODEL_FORMAT, uses all 3 parameters, otherwise extracts these from the Approximation's sharedDataRep to build a filename
 
virtual void rebuild ()
 rebuilds the approximation incrementally
 
virtual void replace (const IntResponsePair &response_pr, size_t fn_index)
 replace the response data
 
virtual void pop_coefficients (bool save_data)
 removes entries from end of SurrogateData::{vars,resp}Data (last points appended, or as specified in args)
 
virtual void push_coefficients ()
 restores state prior to previous pop()
 
virtual void finalize_coefficients ()
 finalize approximation by applying all remaining trial sets
 
virtual void clear_current_active_data ()
 clear current build data in preparation for next build More...
 
virtual void combine_coefficients ()
 combine all level approximations into a single aggregate approximation
 
virtual void combined_to_active_coefficients (bool clear_combined=true)
 promote combined approximation into active approximation
 
virtual void clear_inactive_coefficients ()
 prune inactive coefficients following combination and promotion to active
 
virtual RealVector values (const Variables &vars)
 retrieve the approximate function values for a given parameter vector
 
virtual const RealSymMatrix & hessian (const Variables &vars)
 retrieve the approximate function Hessian for a given parameter vector
 
virtual Real value (const RealVector &c_vars)
 retrieve the approximate function value for a given parameter vector
 
virtual RealVector values (const RealVector &c_vars)
 retrieve the approximate function value for a given parameter vector
 
virtual const RealVector & gradient (const RealVector &c_vars)
 retrieve the approximate function gradient for a given parameter vector
 
virtual const RealSymMatrix & hessian (const RealVector &c_vars)
 retrieve the approximate function Hessian for a given parameter vector
 
virtual Real prediction_variance (const RealVector &c_vars)
 retrieve the variance of the predicted value for a given parameter vector
 
virtual Real mean ()
 return the mean of the expansion, where all active vars are random
 
virtual Real mean (const RealVector &x)
 return the mean of the expansion for a given parameter vector, where a subset of the active variables are random
 
virtual Real combined_mean ()
 return the mean of the combined expansion, where all active vars are random
 
virtual Real combined_mean (const RealVector &x)
 return the mean of the combined expansion for a given parameter vector, where a subset of the active variables are random
 
virtual const RealVector & mean_gradient ()
 return the gradient of the expansion mean
 
virtual const RealVector & mean_gradient (const RealVector &x, const SizetArray &dvv)
 return the gradient of the expansion mean
 
virtual Real variance ()
 return the variance of the expansion, where all active vars are random
 
virtual Real variance (const RealVector &x)
 return the variance of the expansion for a given parameter vector, where a subset of the active variables are random
 
virtual const RealVector & variance_gradient ()
 
virtual const RealVector & variance_gradient (const RealVector &x, const SizetArray &dvv)
 
virtual Real covariance (Approximation &approx_2)
 return the covariance between two response expansions, treating all variables as random
 
virtual Real covariance (const RealVector &x, Approximation &approx_2)
 return the covariance between two response expansions, treating a subset of the variables as random
 
virtual Real combined_covariance (Approximation &approx_2)
 return the covariance between two combined response expansions, where all active variables are random
 
virtual Real combined_covariance (const RealVector &x, Approximation &approx_2)
 return the covariance between two combined response expansions, where a subset of the active variables are random
 
virtual void compute_moments (bool full_stats=true, bool combined_stats=false)
 
virtual void compute_moments (const RealVector &x, bool full_stats=true, bool combined_stats=false)
 
virtual const RealVector & moments () const
 
virtual const RealVector & expansion_moments () const
 
virtual const RealVector & numerical_integration_moments () const
 
virtual const RealVector & combined_moments () const
 
virtual Real moment (size_t i) const
 
virtual void moment (Real mom, size_t i)
 
virtual Real combined_moment (size_t i) const
 
virtual void combined_moment (Real mom, size_t i)
 
virtual void clear_component_effects ()
 
virtual void compute_component_effects ()
 
virtual void compute_total_effects ()
 
virtual const RealVector & sobol_indices () const
 
virtual const RealVector & total_sobol_indices () const
 
virtual ULongULongMap sparse_sobol_index_map () const
 
virtual bool advancement_available ()
 check if resolution advancement (e.g., order, rank) is available for this approximation instance
 
virtual bool diagnostics_available ()
 check if diagnostics are available for this approximation type
 
virtual Real diagnostic (const String &metric_type)
 retrieve a single diagnostic metric for the diagnostic type specified
 
virtual RealArray cv_diagnostic (const StringArray &metric_types, unsigned num_folds)
 retrieve diagnostic metrics for the diagnostic types specified, applying
 
virtual void primary_diagnostics (size_t fn_index)
 compute and print all requested diagnostics and cross-validation
 
virtual RealArray challenge_diagnostic (const StringArray &metric_types, const RealMatrix &challenge_points, const RealVector &challenge_responses)
 compute requested diagnostics for user provided challenge pts
 
virtual void challenge_diagnostics (size_t fn_index, const RealMatrix &challenge_points, const RealVector &challenge_responses)
 compute and print all requested diagnostics for user provided challenge pts
 
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 recommended_coefficients () const
 return the recommended number of samples (unknowns) required to build the derived class approximation type in numVars dimensions
 
virtual int num_constraints () const
 return the number of constraints to be enforced via an anchor point
 
virtual size_t num_components () const
 return the number of approximation components (1 for scalars)
 
virtual void expansion_coefficient_flag (bool)
 
virtual bool expansion_coefficient_flag () const
 
virtual void expansion_gradient_flag (bool)
 
virtual bool expansion_gradient_flag () const
 
virtual void clear_computed_bits ()
 clear tracking of computed moments, due to (expansion) change that invalidates previous results
 
virtual void map_variable_labels (const Variables &dfsm_vars)
 if needed, map passed all variable labels to approximation's labels
 
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)
 
void pop_data (bool save_data)
 removes entries from end of SurrogateData::{vars,resp}Data (last points appended, or as specified in args)
 
void push_data ()
 restores SurrogateData state prior to previous pop()
 
void finalize_data ()
 finalize SurrogateData by applying all remaining trial sets
 
const Pecos::SurrogateData & surrogate_data () const
 return approxData
 
Pecos::SurrogateData & surrogate_data ()
 return approxData
 
void add (const Variables &vars, bool v_copy, const Response &response, size_t fn_index, bool r_copy, bool anchor_flag, int eval_id, size_t key_index=_NPOS)
 create SurrogateData{Vars,Resp} and append to SurrogateData:: {varsData,respData,dataIdentifiers}
 
void add (const Real *c_vars, bool v_copy, const Response &response, size_t fn_index, bool r_copy, bool anchor_flag, int eval_id, size_t key_index=_NPOS)
 create SurrogateData{Vars,Resp} and append to SurrogateData:: {varsData,respData,dataIdentifiers}
 
void add (const Pecos::SurrogateDataVars &sdv, bool v_copy, const Response &response, size_t fn_index, bool r_copy, bool anchor_flag, int eval_id, size_t key_index=_NPOS)
 create a SurrogateDataResp and append to SurrogateData:: {varsData,respData,dataIdentifiers}
 
void add (const Pecos::SurrogateDataVars &sdv, bool v_copy, const Pecos::SurrogateDataResp &sdr, bool r_copy, bool anchor_flag, int eval_id, size_t key_index=_NPOS)
 append to SurrogateData::{varsData,respData,dataIdentifiers}
 
void add_array (const RealMatrix &sample_vars, bool v_copy, const RealVector &sample_resp, bool r_copy, size_t key_index=_NPOS)
 add surrogate data from the provided sample and response data, assuming continuous variables and function values only More...
 
void pop_count (size_t count, size_t key_index)
 appends to SurrogateData::popCountStack (number of entries to pop from end of SurrogateData::{vars,resp}Data, based on size of last data append)
 
void clear_data ()
 clear SurrogateData::{vars,resp}Data for activeKey + embedded keys More...
 
void clear_active_data ()
 clear active approximation data
 
void clear_inactive_data ()
 clear inactive approximation data
 
void clear_active_popped ()
 clear SurrogateData::popped{Vars,Resp}Trials,popCountStack for activeKey
 
void clear_popped ()
 clear SurrogateData::popped{Vars,Resp}Trials,popCountStack for all keys
 
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)
 
std::shared_ptr< 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
 
void build ()
 builds the approximation from scratch
 
Real value (const Variables &vars)
 retrieve the predicted function value for a given parameter set
 
const RealVector & gradient (const Variables &vars)
 retrieve the function gradient at the predicted value for a given parameter set
 
Real prediction_variance (const Variables &vars)
 retrieve the variance of the predicted value for a given parameter set
 
- 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...
 
std::shared_ptr< Approximationget_approx (ProblemDescDB &problem_db, const SharedApproxData &shared_data, const String &approx_label)
 Used only by the standard envelope constructor to initialize approxRep to the appropriate derived type. More...
 
std::shared_ptr< Approximationget_approx (const SharedApproxData &shared_data)
 Used only by the alternate envelope constructor to initialize approxRep to the appropriate derived type. More...
 
Pecos::SurrogateDataVars variables_to_sdv (const Real *sample_c_vars)
 create a SurrogateDataVars instance from a Real*
 
Pecos::SurrogateDataVars variables_to_sdv (const Variables &vars)
 create a SurrogateDataVars instance by extracting data from a Variables object
 
Pecos::SurrogateDataResp response_to_sdr (const Response &response, size_t fn_index)
 create a SurrogateDataResp instance by extracting data for a particular QoI from a Response object
 
void add (const Pecos::SurrogateDataVars &sdv, bool v_copy, const Pecos::SurrogateDataResp &sdr, bool r_copy, bool anchor_flag)
 tracks a new data point by appending to SurrogateData::{vars,Resp}Data
 
void add (int eval_id)
 tracks a new data point by appending to SurrogateData::dataIdentifiers
 
void check_points (size_t num_build_pts)
 Check number of build points against minimum required.
 
void assign_key_index (size_t key_index)
 extract and assign i-th embedded active key
 

Private Types

enum  subsurrogate { LS, GP }
 
enum  subsurrogate_basis { polynomial, radial }
 
enum  testfunction {
  SmoothHerbie, Herbie, Cone, Cross,
  UnitSphere, Linear34
}
 

Private Member Functions

void VPSmodel_build ()
 Function to compute coefficients governing the VPS surrogates.
 
void VPSmodel_apply (const RealVector &new_x, bool variance_flag, bool gradients_flag)
 Function returns a response value using the VPS surface. More...
 

Private Attributes

Real approxValue
 value of the approximation returned by value()
 
Real approxVariance
 value of the approximation returned by prediction_variance()
 
RealMatrix trainPoints
 A 2-D array (num sample sites = rows, num vars = columns) used to create the Gaussian process.
 
RealMatrix trainValues
 An array of response values; one response value per sample site.
 
size_t numObs
 The number of observations on which the GP surface is built.
 
int surrogateOrder
 The order of the polynomial in each Voronoi cell.
 
subsurrogate _vps_subsurrogate
 
subsurrogate_basis _vps_subsurrogate_basis
 
testfunction _vps_test_function
 
double Q [1220]
 
int indx
 
double cc
 
double c
 
double zc
 
double zx
 
double zy
 
size_t qlen
 
size_t _n_dim
 
double * _xmin
 
double * _xmax
 
double _diag
 
size_t _num_inserted_points
 
double ** _sample_points
 
double * _fval
 
double ** _fgrad
 
double *** _fhess
 
size_t ** _sample_neighbors
 
size_t ** _vps_ext_neighbors
 
size_t _vps_order
 
size_t _num_GMRES
 
size_t * _num_cell_basis_functions
 
double * _sample_vsize
 
double * _vps_dfar
 
double *** _sample_basis
 
double _max_vsize
 
double _disc_min_jump
 
double _disc_min_grad
 
double _f_min
 
double _f_max
 
size_t *** _vps_t
 
double ** _vps_w
 
SharedApproxData sharedData
 
std::vector< ApproximationgpApproximations
 
Variables gpEvalVars
 
bool _use_derivatives
 
bool _use_gradient
 
bool _use_hessian
 

Static Private Attributes

static VPSApproximationVPSinstance
 pointer to the active object instance used within the static evaluator More...
 

Additional Inherited Members

- Protected Attributes inherited from Approximation
Pecos::SurrogateData approxData
 contains the variables/response data for constructing a single approximation model (one response function). There is only one SurrogateData instance per Approximation, although it may contain keys for different model forms/resolutions and aggregations (e.g., discrepancies) among forms/resolutions.
 
RealVector approxGradient
 gradient of the approximation returned by gradient()
 
RealSymMatrix approxHessian
 Hessian of the approximation returned by hessian()
 
String approxLabel
 label for approximation, if applicable
 
std::shared_ptr< SharedApproxDatasharedDataRep
 contains the approximation data that is shared among the response set
 
std::shared_ptr< ApproximationapproxRep
 pointer to the letter (initialized only for the envelope)
 

Detailed Description

Derived approximation class for VPS implementation.

The VPSApproximation class provides a set of piecewise surrogate approximations each of which is valid within a Voronoi cell.

Member Function Documentation

◆ VPSmodel_apply()

void VPSmodel_apply ( const RealVector &  new_x,
bool  variance_flag,
bool  gradients_flag 
)
private

Function returns a response value using the VPS surface.

The response value is computed at the design point specified by the RealVector function argument.

References VPSApproximation::approxValue.

Referenced by VPSApproximation::gradient(), VPSApproximation::prediction_variance(), and VPSApproximation::value().

Member Data Documentation

◆ VPSinstance

VPSApproximation * VPSinstance
staticprivate

pointer to the active object instance used within the static evaluator

default constructor


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