de.torstennahm.integrate.sparse
Class WeightedIntegrator

java.lang.Object
  extended by de.torstennahm.integrate.Integrator<Evaluator>
      extended by de.torstennahm.integrate.sparse.WeightedIntegrator

public class WeightedIntegrator
extends Integrator<Evaluator>

Adaptive sparse grid integrator that uses a weighted balance of index contributions and work in expanding the index set. With the default constructor, the integrator uses a pure greedy approache: It will always add that value to the index set whose calculated contribution is the largest, regardless of the work involved. However, it is possible to balance this against the work involved, by supplying a weight w factor in the constructor. In this case, w balances the calculated contribution against the amount of work involved with the following formula:
priority = max((1-w)*relContribution,w*(1/relWork)),
where relContribution is the quotient of the calculated contribution for the index and the (current estimate of the) integral value, and relWork is the quotient between the number of function calls required for evaluating the index and those for the zero index.

The default is the same as setting w to 0 in the above formula. If on the other hand w is 1, the controller will default to non-adaptive simplicial sparse grid integration, as relWork increases monotonically with the length of the index.

Note that although the valid indices whose contributions have been calculated are not formally part of the index set, their contributions still are used for the integral value, as this can only improve accuracy.

This class implements the original algorithm for sparse grid integration published in: T. Gerstner and M. Griebel. Dimension-Adaptive Tensor-Product Quadrature. Computing, 71(1):65-87, 2003

This class is thread-safe.

Author:
Torsten Nahm
See Also:
Integrator, IntegrationResult, Evaluator, Visualizer

Field Summary
protected  double workWeight
          Factor for balance between greedy and work
 
Constructor Summary
WeightedIntegrator()
          Constructs the weighted sparse integrator with the default settings.
WeightedIntegrator(double workWeight)
          Construct the weighted sparse integrator with the specified work weight factor.
 
Method Summary
 IntegrationResult integrate(Evaluator evaluator, StopCondition condition, java.util.List<Visualizer> visualizers)
          Performs numerical integration of the integrand until the given condition is fulfilled.
 java.lang.String toString()
           
 
Methods inherited from class de.torstennahm.integrate.Integrator
integrate, integrateAbsTol, integrateAbsTol, integrateByPoints, integrateByPoints, integrateRelTol, integrateRelTol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

workWeight

protected final double workWeight
Factor for balance between greedy and work

Constructor Detail

WeightedIntegrator

public WeightedIntegrator()
Constructs the weighted sparse integrator with the default settings. The default setting is to only use the calculated contribution for each index, and is the same as using WeightedIntegrator(0).

See Also:
WeightedIntegrator(double)

WeightedIntegrator

public WeightedIntegrator(double workWeight)
Construct the weighted sparse integrator with the specified work weight factor. For work weight 0, only the calculated contribution for an index is used, for and for weight 1, only the work required for evaluating the index is used. Values in between these extremes represent a relative mix of the two strategies.

Parameters:
workWeight - factor for balancing contribution against work; must be between 0 and 1
Throws:
java.lang.IllegalArgumentException - if the work weight is out of range
Method Detail

integrate

public IntegrationResult integrate(Evaluator evaluator,
                                   StopCondition condition,
                                   java.util.List<Visualizer> visualizers)
                            throws IntegrationFailedException
Description copied from class: Integrator
Performs numerical integration of the integrand until the given condition is fulfilled.

Specified by:
integrate in class Integrator<Evaluator>
Parameters:
evaluator - object to be integrated
condition - stop condition
visualizers - list of visualizers or null for no visualization
Returns:
result of integration
Throws:
IntegrationFailedException - if an integration error occurs

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object