SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
sgpp::combigrid::AdaptiveCombinationGridGenerator Class Reference

The AdaptiveCombinationGridGenerator is a (potentially changing) representation of a combination grid that also tracks the Quantities of Interest; in contrast to a CombinationGrid, it stores the full downward closed set of levels. More...

#include <AdaptiveCombinationGridGenerator.hpp>

Public Member Functions

bool adaptAllKnown ()
 add all subspaces of known result to the old set
 
 AdaptiveCombinationGridGenerator (const std::vector< LevelVector > &levelVectors, const std::vector< double > &&QoIValues, std::function< double(double, double)> summationFunction, std::shared_ptr< RelevanceCalculator > relevanceCalculator=std::shared_ptr< RelevanceCalculator >(new WeightedRelevanceCalculator()), std::shared_ptr< PriorityEstimator > priorityEstimator=std::shared_ptr< PriorityEstimator >(new AveragingPriorityEstimator()))
 Construct a new AdaptiveCombinationGridGenerator object.
 
 AdaptiveCombinationGridGenerator (const std::vector< LevelVector > &levelVectors, std::function< double(double, double)> summationFunction, std::shared_ptr< RelevanceCalculator > relevanceCalculator=std::shared_ptr< RelevanceCalculator >(new WeightedRelevanceCalculator()), std::shared_ptr< PriorityEstimator > priorityEstimator=std::shared_ptr< PriorityEstimator >(new AveragingPriorityEstimator()))
 like above, with default QoI values if they are not supplied
 
 AdaptiveCombinationGridGenerator (const std::vector< LevelVector > &levelVectors, std::shared_ptr< RelevanceCalculator > relevanceCalculator=std::shared_ptr< RelevanceCalculator >(new WeightedRelevanceCalculator()), std::shared_ptr< PriorityEstimator > priorityEstimator=std::shared_ptr< PriorityEstimator >(new AveragingPriorityEstimator()))
 like above, but setting the summationFunction to std::plus<double>() by default
 
bool adaptNextLevelVector (bool regular=false)
 add the next most important subspace of known result to the old set
 
std::vector< LevelVectorgetActiveSet () const
 Get the level vectors of the active set (= admissible upward neighbors of the old set)
 
CombinationGrid getCombinationGrid (const HeterogeneousBasis &basis, bool hasBoundary=true) const
 Get the the currently valid combination grid consisting of the "old set" (the combination grid only holds the full grid vectors with non-zero coefficients)
 
double getCurrentResult () const
 Get current result based on the old set.
 
double getDelta (const LevelVector &levelVector) const
 Get the delta belonging to a level vector.
 
std::vector< double > getDeltas (const std::vector< LevelVector > &levelVectors) const
 Get the deltas belonging to the list of supplied level vectors.
 
std::vector< LevelVectorgetLevels () const
 Get the level vectors of the active set (= admissible upward neighbors of the old set)
 
const LevelVectorgetMinimumLevelVector () const
 Get the minimum Level Vector object.
 
std::vector< LevelVectorgetOldSet () const
 Get the level vectors of the old set.
 
std::map< LevelVector, double > getPriorities () const
 get the levels and priority of elements in the active set that don't have a result / QoI value / delta yet
 
std::vector< LevelVectorgetPriorityQueue () const
 get a priority queue of elements in the active set that don't have a result / QoI / delta yet
 
double getQoIInformation (const LevelVector &level)
 get QoI information / the stored result for LevelVector level
 
std::map< LevelVector, double > getRelevanceOfActiveSet () const
 get exact value of relevance / "error" of those elements in the active set that already have a QoI value
 
const std::map< LevelVector, double > & getSubspacesAndQoIs () const
 Get the subspacesAndQoIs object.
 
bool hasQoIInformation (const LevelVector &level)
 is Qoi information stored for LevelVector level?
 
void setQoIInformation (const LevelVector &level, double qoi)
 set QoI information / a result for LevelVector level
 

Static Public Member Functions

static AdaptiveCombinationGridGenerator fromCombinationGrid (const CombinationGrid &combinationGrid, const std::vector< double > &&QoIValues, std::function< double(double, double)> summationFunction=std::plus< double >(), std::shared_ptr< RelevanceCalculator > relevanceCalculator=std::shared_ptr< RelevanceCalculator >(new WeightedRelevanceCalculator()), std::shared_ptr< PriorityEstimator > priorityEstimator=std::shared_ptr< PriorityEstimator >(new AveragingPriorityEstimator()))
 Construct a new AdaptiveCombinationGridGenerator object.
 
static AdaptiveCombinationGridGenerator fromCombinationGrid (const CombinationGrid &combinationGrid, std::function< double(double, double)> summationFunction=std::plus< double >(), std::shared_ptr< RelevanceCalculator > relevanceCalculator=std::shared_ptr< RelevanceCalculator >(new WeightedRelevanceCalculator()), std::shared_ptr< PriorityEstimator > priorityEstimator=std::shared_ptr< PriorityEstimator >(new AveragingPriorityEstimator()))
 like above, with default QoI values if they are not supplied
 

Detailed Description

The AdaptiveCombinationGridGenerator is a (potentially changing) representation of a combination grid that also tracks the Quantities of Interest; in contrast to a CombinationGrid, it stores the full downward closed set of levels.

The adaptation is performed based on a scalar Quantity of Interest passed to the AdaptiveCombinationGridGenerator via setQoIInformation .

There are – potentially – three categories of level vectors in an AdaptiveCombinationGridGenerator, those that are already selected by the adaptive algorithm ("old set"), candidates for the old set which are not yet selected whose QoIs we may or may not yet know ("active set"), and others that are outside either of those (whose QoI we are already storing for later use).

When doing adaptation by adaptNextLevelVector , an admissible level vector is moved from the active to the old set. That level vector will be selected by the relevanceCalculator based on delta, a measure for how much the combined QoI will change if a particular level vector would be added.

If grid evaluations are expensive and one would like to know which QoIs should be computed next, a priority queue can be obtained by getPriorityQueue , which uses the priorityEstimator to infer a priority for the active set levels from the QoIs of the downward neighbors.

Terminology is mostly taken from Gerstner, T. and Griebel, M., 2003. Dimension–adaptive tensor–product quadrature. Computing, 71(1), pp.65-87.

Constructor & Destructor Documentation

◆ AdaptiveCombinationGridGenerator() [1/3]

sgpp::combigrid::AdaptiveCombinationGridGenerator::AdaptiveCombinationGridGenerator ( const std::vector< LevelVector > &  levelVectors,
const std::vector< double > &&  QoIValues,
std::function< double(double, double)>  summationFunction,
std::shared_ptr< RelevanceCalculator relevanceCalculator = std::shared_ptr<RelevanceCalculator>(new WeightedRelevanceCalculator()),
std::shared_ptr< PriorityEstimator priorityEstimator = std::shared_ptr<PriorityEstimator>(new AveragingPriorityEstimator()) 
)

Construct a new AdaptiveCombinationGridGenerator object.

Parameters
levelVectorsstart with these level vectors, cannot be empty
QoIValuesthe QoI values corresponding to levelVectors, same length as levelVectors
summationFunctionthe summation function by which results are combined
relevanceCalculatora relevance calculator relating deltas and level vectors to an "error"/relevance estimate
priorityEstimatora priority estimator to get the priority of a level / subspace whose result we don't yet know (similar to relevanceCalculator, but based on the deltas of the downward neighbors instead of the level's own delta)

References level, and sgpp::combigrid::LevelVectorTools::makeDownwardClosed().

◆ AdaptiveCombinationGridGenerator() [2/3]

sgpp::combigrid::AdaptiveCombinationGridGenerator::AdaptiveCombinationGridGenerator ( const std::vector< LevelVector > &  levelVectors,
std::function< double(double, double)>  summationFunction,
std::shared_ptr< RelevanceCalculator relevanceCalculator = std::shared_ptr<RelevanceCalculator>(new WeightedRelevanceCalculator()),
std::shared_ptr< PriorityEstimator priorityEstimator = std::shared_ptr<PriorityEstimator>(new AveragingPriorityEstimator()) 
)
inline

like above, with default QoI values if they are not supplied

◆ AdaptiveCombinationGridGenerator() [3/3]

sgpp::combigrid::AdaptiveCombinationGridGenerator::AdaptiveCombinationGridGenerator ( const std::vector< LevelVector > &  levelVectors,
std::shared_ptr< RelevanceCalculator relevanceCalculator = std::shared_ptr<RelevanceCalculator>(new WeightedRelevanceCalculator()),
std::shared_ptr< PriorityEstimator priorityEstimator = std::shared_ptr<PriorityEstimator>(new AveragingPriorityEstimator()) 
)
inline

like above, but setting the summationFunction to std::plus<double>() by default

Member Function Documentation

◆ adaptAllKnown()

bool sgpp::combigrid::AdaptiveCombinationGridGenerator::adaptAllKnown ( )

add all subspaces of known result to the old set

References adaptNextLevelVector().

◆ adaptNextLevelVector()

bool sgpp::combigrid::AdaptiveCombinationGridGenerator::adaptNextLevelVector ( bool  regular = false)

add the next most important subspace of known result to the old set

Parameters
regularadd only subspaces of the next regular level, or none
Returns
true if there was a subspace added
false if there was no subspace added (e.g. because all known results were in the old set already) //TODO(pollinta): use regular parameter

References getRelevanceOfActiveSet().

Referenced by adaptAllKnown().

◆ fromCombinationGrid() [1/2]

AdaptiveCombinationGridGenerator sgpp::combigrid::AdaptiveCombinationGridGenerator::fromCombinationGrid ( const CombinationGrid combinationGrid,
const std::vector< double > &&  QoIValues,
std::function< double(double, double)>  summationFunction = std::plus<double>(),
std::shared_ptr< RelevanceCalculator relevanceCalculator = std::shared_ptr<RelevanceCalculator>(new WeightedRelevanceCalculator()),
std::shared_ptr< PriorityEstimator priorityEstimator = std::shared_ptr<PriorityEstimator>(new AveragingPriorityEstimator()) 
)
static

Construct a new AdaptiveCombinationGridGenerator object.

Parameters
combinationGridstart with the subspaces contained in combinationGrid (must be at least one)
QoIValuesthe QoI values corresponding to levelVectors, same length as the number of FullGrids in combinationGrid
summationFunctionthe summation function by which results are combined
relevanceCalculatora relevance calculator relating deltas and level vectors to an "error"/relevance estimate
priorityEstimatora priority estimator to get the priority of a level / subspace whose result we don't yet know (similar to relevanceCalculator, but based on the deltas of the downward neighbors instead of the level's own delta)

References sgpp::combigrid::CombinationGrid::getFullGrids().

Referenced by fromCombinationGrid().

◆ fromCombinationGrid() [2/2]

static AdaptiveCombinationGridGenerator sgpp::combigrid::AdaptiveCombinationGridGenerator::fromCombinationGrid ( const CombinationGrid combinationGrid,
std::function< double(double, double)>  summationFunction = std::plus<double>(),
std::shared_ptr< RelevanceCalculator relevanceCalculator = std::shared_ptr<RelevanceCalculator>(new WeightedRelevanceCalculator()),
std::shared_ptr< PriorityEstimator priorityEstimator = std::shared_ptr<PriorityEstimator>(new AveragingPriorityEstimator()) 
)
inlinestatic

like above, with default QoI values if they are not supplied

References fromCombinationGrid(), and sgpp::combigrid::CombinationGrid::getFullGrids().

◆ getActiveSet()

std::vector< LevelVector > sgpp::combigrid::AdaptiveCombinationGridGenerator::getActiveSet ( ) const

Get the level vectors of the active set (= admissible upward neighbors of the old set)

Returns
std::vector<LevelVector> the active set

Referenced by getLevels().

◆ getCombinationGrid()

CombinationGrid sgpp::combigrid::AdaptiveCombinationGridGenerator::getCombinationGrid ( const HeterogeneousBasis basis,
bool  hasBoundary = true 
) const

Get the the currently valid combination grid consisting of the "old set" (the combination grid only holds the full grid vectors with non-zero coefficients)

References sgpp::combigrid::CombinationGrid::fromSubspaces(), getOldSet(), and sgpp::combigrid::getStandardCoefficientsFromLevelSet().

◆ getCurrentResult()

double sgpp::combigrid::AdaptiveCombinationGridGenerator::getCurrentResult ( ) const

Get current result based on the old set.

Returns
the combined QoI

References getOldSet(), and sgpp::combigrid::getStandardCoefficientsFromLevelSet().

◆ getDelta()

double sgpp::combigrid::AdaptiveCombinationGridGenerator::getDelta ( const LevelVector levelVector) const

Get the delta belonging to a level vector.

Delta denotes by how much the combined value of QoI would be influenced if this level vector would be adapted to

Returns
double the delta value, NaN if result is unknown

References sgpp::combigrid::LevelVectorTools::generateHyperCube().

Referenced by getDeltas(), getPriorities(), and getRelevanceOfActiveSet().

◆ getDeltas()

std::vector< double > sgpp::combigrid::AdaptiveCombinationGridGenerator::getDeltas ( const std::vector< LevelVector > &  levelVectors) const

Get the deltas belonging to the list of supplied level vectors.

Returns
double the delta value, NaN if result is unknown

References getDelta().

◆ getLevels()

std::vector< LevelVector > sgpp::combigrid::AdaptiveCombinationGridGenerator::getLevels ( ) const

Get the level vectors of the active set (= admissible upward neighbors of the old set)

Returns
std::vector<LevelVector> all levels (old and active)

References getActiveSet(), and getOldSet().

◆ getMinimumLevelVector()

const LevelVector & sgpp::combigrid::AdaptiveCombinationGridGenerator::getMinimumLevelVector ( ) const
inline

Get the minimum Level Vector object.

Returns
const LevelVector&

◆ getOldSet()

std::vector< LevelVector > sgpp::combigrid::AdaptiveCombinationGridGenerator::getOldSet ( ) const
inline

Get the level vectors of the old set.

Returns
std::vector<LevelVector> the old set

Referenced by getCombinationGrid(), getCurrentResult(), and getLevels().

◆ getPriorities()

std::map< LevelVector, double > sgpp::combigrid::AdaptiveCombinationGridGenerator::getPriorities ( ) const

get the levels and priority of elements in the active set that don't have a result / QoI value / delta yet

References getDelta().

Referenced by getPriorityQueue().

◆ getPriorityQueue()

std::vector< LevelVector > sgpp::combigrid::AdaptiveCombinationGridGenerator::getPriorityQueue ( ) const

get a priority queue of elements in the active set that don't have a result / QoI / delta yet

References getPriorities().

◆ getQoIInformation()

double sgpp::combigrid::AdaptiveCombinationGridGenerator::getQoIInformation ( const LevelVector level)
inline

get QoI information / the stored result for LevelVector level

References level.

◆ getRelevanceOfActiveSet()

std::map< LevelVector, double > sgpp::combigrid::AdaptiveCombinationGridGenerator::getRelevanceOfActiveSet ( ) const

get exact value of relevance / "error" of those elements in the active set that already have a QoI value

References getDelta().

Referenced by adaptNextLevelVector().

◆ getSubspacesAndQoIs()

const std::map< LevelVector, double > & sgpp::combigrid::AdaptiveCombinationGridGenerator::getSubspacesAndQoIs ( ) const
inline

Get the subspacesAndQoIs object.

◆ hasQoIInformation()

bool sgpp::combigrid::AdaptiveCombinationGridGenerator::hasQoIInformation ( const LevelVector level)
inline

is Qoi information stored for LevelVector level?

References level.

◆ setQoIInformation()

void sgpp::combigrid::AdaptiveCombinationGridGenerator::setQoIInformation ( const LevelVector level,
double  qoi 
)
inline

set QoI information / a result for LevelVector level

References level.


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