SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
sgpp::optimization::ResponseSurface Class Referenceabstract

General response surface. More...

#include <ResponseSurface.hpp>

Inheritance diagram for sgpp::optimization::ResponseSurface:
sgpp::optimization::SplineResponseSurface

Public Member Functions

virtual double eval (sgpp::base::DataVector v)
 evaluates the response surface [Attention: this is not alway simply "interpolant->eval".
 
virtual double evalGradient (sgpp::base::DataVector v, sgpp::base::DataVector &gradient)=0
 evaluates the response surface and its gradient
 
double l2Error (std::shared_ptr< sgpp::base::ScalarFunction > objectiveFunc, size_t numMCPoints=1000)
 Calculates the l2 error between interpolant and objective function.
 
sgpp::base::DataVector nrmsError (std::shared_ptr< sgpp::base::ScalarFunction > objectiveFunc, size_t numMCPoints=1000)
 Calculates the normalized root mean square error between interpolant and objective function in random points.
 
sgpp::base::DataVector nrmsErrorFromTestData (const std::string &fileName, size_t numMCPoints, size_t numDim)
 Calculates the normalized root mean square error between interpolant and objective function from a precalculated set of test points and according values (this set is usually generated by ResponseSurface::precalculateErrorTestData)
 
void precalculateErrorTestData (std::shared_ptr< sgpp::base::ScalarFunction > objectiveFunc, size_t numMCPoints, const std::string &fileName)
 Evaluates the objective function in random points and stores these points with the according evaluation value The stored set of test data can then later be used to calculate and compare the approximation error.
 
 ResponseSurface (size_t numDim)
 Constructor.
 
virtual ~ResponseSurface ()
 Destructor.
 

Protected Member Functions

double domainVolume ()
 calculates the volume of the tensor product domain given by lb and ub
 
void transformPoint (sgpp::base::DataVector &v, sgpp::base::DataVector lBounds, sgpp::base::DataVector uBounds, sgpp::base::DataVector newlBounds, sgpp::base::DataVector newuBounds)
 transforms a point in hyper-rectangle [lBounds,rBounds] to the hyper-rectangle [newlBounds,newuBounds]
 

Protected Attributes

std::shared_ptr< sgpp::base::ScalarFunctioninterpolant
 
std::shared_ptr< sgpp::base::ScalarFunctionGradientinterpolantGradient
 
sgpp::base::DataVector lb
 
size_t numDim
 
sgpp::base::DataVector ub
 

Detailed Description

General response surface.

Represents an approximation of some function. Usually the approximation is created via interpolation. (But could also be regression for example)

Constructor & Destructor Documentation

◆ ResponseSurface()

sgpp::optimization::ResponseSurface::ResponseSurface ( size_t  numDim)
inlineexplicit

Constructor.

◆ ~ResponseSurface()

virtual sgpp::optimization::ResponseSurface::~ResponseSurface ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ domainVolume()

double sgpp::optimization::ResponseSurface::domainVolume ( )
protected

calculates the volume of the tensor product domain given by lb and ub

Returns
volume

References lb, numDim, and ub.

Referenced by sgpp::optimization::SplineResponseSurface::getIntegral().

◆ eval()

double sgpp::optimization::ResponseSurface::eval ( sgpp::base::DataVector  v)
virtual

evaluates the response surface [Attention: this is not alway simply "interpolant->eval".

In context of active subspaces, for example, the argument v must first be transformed to the active subspace]

Parameters
vpoint in which the response surface shall be evaulated
Returns
evaluation

Reimplemented in sgpp::optimization::SplineResponseSurface.

References interpolant.

Referenced by python.uq.analysis.asgc.ASGCAnalysis.ASGCAnalysis::estimateDensity(), l2Error(), nrmsError(), and nrmsErrorFromTestData().

◆ evalGradient()

virtual double sgpp::optimization::ResponseSurface::evalGradient ( sgpp::base::DataVector  v,
sgpp::base::DataVector gradient 
)
pure virtual

evaluates the response surface and its gradient

Parameters
vpoint in which the response surface shall be evaluated
gradientreference to return the gradient evaluated in v
Returns
evaluation

Implemented in sgpp::optimization::SplineResponseSurface.

◆ l2Error()

double sgpp::optimization::ResponseSurface::l2Error ( std::shared_ptr< sgpp::base::ScalarFunction objectiveFunc,
size_t  numMCPoints = 1000 
)

Calculates the l2 error between interpolant and objective function.

Parameters
objectiveFuncthe objectiveFunction
numMCPointsnumber of Monte Carlo Points
Returns
l2 error

References eval(), sgpp::base::RandomNumberGenerator::getInstance(), sgpp::base::RandomNumberGenerator::getUniformRN(), lb, numDim, and ub.

◆ nrmsError()

sgpp::base::DataVector sgpp::optimization::ResponseSurface::nrmsError ( std::shared_ptr< sgpp::base::ScalarFunction objectiveFunc,
size_t  numMCPoints = 1000 
)

Calculates the normalized root mean square error between interpolant and objective function in random points.

Parameters
objectiveFuncthe objectiveFunction
numMCPointsnumber of Monte Carlo Points
Returns
vector [NRMSE, l2 error, min, max]

References eval(), sgpp::base::RandomNumberGenerator::getInstance(), sgpp::base::RandomNumberGenerator::getUniformRN(), lb, numDim, and ub.

◆ nrmsErrorFromTestData()

sgpp::base::DataVector sgpp::optimization::ResponseSurface::nrmsErrorFromTestData ( const std::string &  fileName,
size_t  numMCPoints,
size_t  numDim 
)

Calculates the normalized root mean square error between interpolant and objective function from a precalculated set of test points and according values (this set is usually generated by ResponseSurface::precalculateErrorTestData)

Parameters
fileNamepath to the stored data set
numMCPointsthe first numMCPoints of the data set are used
numDimnumber of dimensions
Returns
vector [NRMSE, l2 error, min, max]

References eval(), fileName, sgpp::base::DataMatrix::fromFile(), and numDim.

◆ precalculateErrorTestData()

void sgpp::optimization::ResponseSurface::precalculateErrorTestData ( std::shared_ptr< sgpp::base::ScalarFunction objectiveFunc,
size_t  numMCPoints,
const std::string &  fileName 
)

Evaluates the objective function in random points and stores these points with the according evaluation value The stored set of test data can then later be used to calculate and compare the approximation error.

Parameters
objectiveFuncthe objective function
numMCPointsnumber of Monte carlo Points
fileNamepath specifying where to save the generated data

References fileName, sgpp::base::RandomNumberGenerator::getInstance(), sgpp::base::RandomNumberGenerator::getUniformRN(), lb, numDim, and ub.

◆ transformPoint()

void sgpp::optimization::ResponseSurface::transformPoint ( sgpp::base::DataVector v,
sgpp::base::DataVector  lBounds,
sgpp::base::DataVector  uBounds,
sgpp::base::DataVector  newlBounds,
sgpp::base::DataVector  newuBounds 
)
protected

transforms a point in hyper-rectangle [lBounds,rBounds] to the hyper-rectangle [newlBounds,newuBounds]

Parameters
vpoint in [lBounds,uBounds]
lBoundslower bounds
uBoundsupper bounds
newlBoundsnew lower bounds
newuBoundsnew upper bounds

References sgpp::base::DataVector::add(), sgpp::base::DataVector::componentwise_div(), sgpp::base::DataVector::componentwise_mult(), and sgpp::base::DataVector::sub().

Referenced by sgpp::optimization::SplineResponseSurface::eval(), sgpp::optimization::SplineResponseSurface::evalGradient(), and sgpp::optimization::SplineResponseSurface::optimize().

Member Data Documentation

◆ interpolant

◆ interpolantGradient

◆ lb

◆ numDim

◆ ub


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