API  4.5
For C++ developers
OpenSim::LatinHypercubeDesign Class Reference

A class for generating Latin hypercube designs. More...

Public Member Functions

 LatinHypercubeDesign ()
 
 LatinHypercubeDesign (const LatinHypercubeDesign &)
 
 LatinHypercubeDesign (LatinHypercubeDesign &&)
 
LatinHypercubeDesignoperator= (const LatinHypercubeDesign &)
 
LatinHypercubeDesignoperator= (LatinHypercubeDesign &&)
 
void setNumSamples (int numSamples)
 The number of samples in the Latin hypercube design (i.e., the number of rows in the design matrix). More...
 
int getNumSamples () const
 The number of samples in the Latin hypercube design (i.e., the number of rows in the design matrix). More...
 
void setNumVariables (int numVariables)
 The number of variables in the Latin hypercube design (i.e., the number of columns in the design matrix). More...
 
int getNumVariables () const
 The number of variables in the Latin hypercube design (i.e., the number of columns in the design matrix). More...
 
void setDistanceCriterion (std::string distanceCriterion)
 The criterion used to evaluate the distance between samples in the Latin hypercube design ("maximin" or "phi_p"). More...
 
const std::string & getDistanceCriterion () const
 The criterion used to evaluate the distance between samples in the Latin hypercube design ("maximin" or "phi_p"). More...
 
void setPhiPDistanceExponent (int exponent)
 The exponent used to evaluate the "phi_p" distance criterion. More...
 
int getPhiPDistanceExponent () const
 The exponent used to evaluate the "phi_p" distance criterion. More...
 
SimTK::Matrix generateRandomDesign (int iterations=100) const
 Generate a Latin hypercube design based on the best design score from multiple random designs. More...
 
SimTK::Matrix generateTranslationalPropagationDesign (int numSeedPoints=-1) const
 Generate a Latin hypercube design based on the translational propagation algorithm from Viana et al. More...
 
SimTK::Matrix generateStochasticEvolutionaryDesign (int iterations=10, const SimTK::Matrix &initialDesign={}) const
 Generate a Latin hypercube design based on the enhanced stochastic evolutionary algorithm from Jin et al. More...
 
double evaluateDesign (const SimTK::Matrix &design) const
 Evaluate the distance between samples in the Latin hypercube design according to the distance criterion specified by the user. More...
 

Detailed Description

A class for generating Latin hypercube designs.

Latin hypercube design

A Latin hypercube is an m-by-n matrix, where 'm' is the number of design samples and 'n' is the number of variables in the design. Each sample point (i.e., each row in the design) is the only sample point in its row and column in the hypercube defined by the number of variables.

Latin hypercube designs are useful for sampling large, multivariate parameter spaces. Optimal Latin hypercube designs are those that maximize the minimum distance between samples in the design. This class provides methods for generating random Latin hypercube designs, as well as methods for generating Latin hypercube designs using the translational propagation algorithm from Viana et al. (2009) and the enhanced stochastic evolutionary algorithm from Jin et al. (2005).

How to create a Latin hypercube design

To create a Latin hypercube design, you must first specify the number of variables and samples in the design, and, optionally, the distance criterion used to evaluate each design. The distance criterion can be either "maximin" or "phi_p", where "maximin" is the default. The "phi_p" distance criterion is an approximation of the "maximin" criterion that can be used to generate designs that minimize the sum of inverse distances raised to a large exponent (see [2] for more details). The exponent used for the "phi_p" distance criterion can be set using the setPhiPDistanceExponent() method.

For example, a random Latin hypercube design with 10 samples and 3 variables can be created as follows:

lhs.setNumSamples(10);
lhs.setNumVariables(3);
SimTK::Matrix design = lhs.generateRandomDesign();

A design using the translational propagation algorithm can be created as follows:

SimTK::Matrix tplhsDesign = lhs.generateTranslationalPropagationDesign();

A design using the enhanced stochastic evolutionary algorithm can be created as follows:

SimTK::Matrix eseaDesign = lhs.generateStochasticEvolutionaryDesign();

Finally, each design can be evaluated using the evaluateDesign() method:

double score = lhs.evaluateDesign(design);

Lower design scores are better. Since the original "maximin" is a maximization criterion, here we negate it so it strictly takes on negative values. The "phi_p" criterion returns a positive value since it is a minimization criterion. While both criteria aim to achieve a similar goal, the values returned by each are not directly comparable.

Recommendations for different sized designs

To rapidly create a random Latin hypercube design of any size, generateRandomDesign() is recommended. This method is fast, but does not guarantee that the design is optimal.

To rapidly create Latin hypercube designs with a small number of samples (fewer than ~25) and variables (fewer than ~5), generateTranslationalPropagationDesign() is recommended. This method uses a deterministic algorithm that translates and propagates a "seed" design throughout the design space to generate a Latin hypercube design.

Finally, to optimize Latin hypercube designs with larger numbers of samples and variable, generateStochasticEvolutionaryDesign() is recommended. This approach randomly exchanges samples between columns in the design matrix and accepts new designs based on an evolving warming and cooling schedule. This method is slower than the other two methods, but generally leads to better designs. This algorithm requires many evaluations of the design score, so it is recommended to use the "phi_p" distance criterion, which approximates "maximin", but is much faster.

References

  • [1] Viana, F.A.C., Venter, G. and Balabanov, V. (2010), An algorithm for fast optimal Latin hypercube design of experiments. Int. J. Numer. Meth. Engng., 82: 135-156. https://doi.org/10.1002/nme.2750
  • [2] Jin, R., Chen, W., and Sudjianto, A. (2005) An efficient algorithm for constructing optimal design of computer experiments, Journal of Statistical Planning and Inference, Volume 134, Issue 1, Pages 268-287, https://doi.org/10.1016/j.jspi.2004.02.014.

Constructor & Destructor Documentation

◆ LatinHypercubeDesign() [1/3]

OpenSim::LatinHypercubeDesign::LatinHypercubeDesign ( )

◆ LatinHypercubeDesign() [2/3]

OpenSim::LatinHypercubeDesign::LatinHypercubeDesign ( const LatinHypercubeDesign )

◆ LatinHypercubeDesign() [3/3]

OpenSim::LatinHypercubeDesign::LatinHypercubeDesign ( LatinHypercubeDesign &&  )

Member Function Documentation

◆ evaluateDesign()

double OpenSim::LatinHypercubeDesign::evaluateDesign ( const SimTK::Matrix &  design) const

Evaluate the distance between samples in the Latin hypercube design according to the distance criterion specified by the user.

The "maximin" criterion returns a negative value since it is a maximization criterion, while the "phi_p" criterion returns a positive value since it is a minimization criterion.

◆ generateRandomDesign()

SimTK::Matrix OpenSim::LatinHypercubeDesign::generateRandomDesign ( int  iterations = 100) const

Generate a Latin hypercube design based on the best design score from multiple random designs.

Use the 'iterations' parameter to specify the number of random designs to evaluate before selecting a design.

◆ generateStochasticEvolutionaryDesign()

SimTK::Matrix OpenSim::LatinHypercubeDesign::generateStochasticEvolutionaryDesign ( int  iterations = 10,
const SimTK::Matrix &  initialDesign = {} 
) const

Generate a Latin hypercube design based on the enhanced stochastic evolutionary algorithm from Jin et al.

(2005). Use the 'iterations' parameter to specify the number of iterations to run the algorithm (i.e., the number of outer loop iterations). The number of inner loop iterations and column exchanges are determined automatically based on the number of samples in the design. Optionally, an initial design can be provided to the algorithm using the 'initialDesign' parameter.

◆ generateTranslationalPropagationDesign()

SimTK::Matrix OpenSim::LatinHypercubeDesign::generateTranslationalPropagationDesign ( int  numSeedPoints = -1) const

Generate a Latin hypercube design based on the translational propagation algorithm from Viana et al.

(2009). Use the 'numSeedPoints' parameter to specify the number of seed points to use in the algorithm. The default behavior (numSeedPoints = -1) will iterate through several designs starting with seeds with number of seed points between 5% and 25% of the total number of samples in the design.

◆ getDistanceCriterion()

const std::string& OpenSim::LatinHypercubeDesign::getDistanceCriterion ( ) const

The criterion used to evaluate the distance between samples in the Latin hypercube design ("maximin" or "phi_p").

◆ getNumSamples()

int OpenSim::LatinHypercubeDesign::getNumSamples ( ) const

The number of samples in the Latin hypercube design (i.e., the number of rows in the design matrix).

◆ getNumVariables()

int OpenSim::LatinHypercubeDesign::getNumVariables ( ) const

The number of variables in the Latin hypercube design (i.e., the number of columns in the design matrix).

◆ getPhiPDistanceExponent()

int OpenSim::LatinHypercubeDesign::getPhiPDistanceExponent ( ) const

The exponent used to evaluate the "phi_p" distance criterion.

This can be any non-zero integer, but should be set to a relatively large value (e.g., 50) to ensure that the criterion sufficiently approximates the "maximin" criterion.

◆ operator=() [1/2]

LatinHypercubeDesign& OpenSim::LatinHypercubeDesign::operator= ( const LatinHypercubeDesign )

◆ operator=() [2/2]

LatinHypercubeDesign& OpenSim::LatinHypercubeDesign::operator= ( LatinHypercubeDesign &&  )

◆ setDistanceCriterion()

void OpenSim::LatinHypercubeDesign::setDistanceCriterion ( std::string  distanceCriterion)

The criterion used to evaluate the distance between samples in the Latin hypercube design ("maximin" or "phi_p").

◆ setNumSamples()

void OpenSim::LatinHypercubeDesign::setNumSamples ( int  numSamples)

The number of samples in the Latin hypercube design (i.e., the number of rows in the design matrix).

◆ setNumVariables()

void OpenSim::LatinHypercubeDesign::setNumVariables ( int  numVariables)

The number of variables in the Latin hypercube design (i.e., the number of columns in the design matrix).

◆ setPhiPDistanceExponent()

void OpenSim::LatinHypercubeDesign::setPhiPDistanceExponent ( int  exponent)

The exponent used to evaluate the "phi_p" distance criterion.

This can be any non-zero integer, but should be set to a relatively large value (e.g., 50) to ensure that the criterion sufficiently approximates the "maximin" criterion.


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