SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | Protected Attributes | List of all members
ArrayOfDoubleChains Class Reference

Similar to ArrayOfComparableChains, except that instead of working with \(n\) clones of a MarkovChain, we use a single MarkovChainDouble object for all the chains. More...

Inheritance diagram for ArrayOfDoubleChains:
[legend]
Collaboration diagram for ArrayOfDoubleChains:
[legend]

Public Member Functions

 ArrayOfDoubleChains (MarkovChainDouble baseChain, PointSetRandomization rand)
 Creates a virtual array for the chain baseChain. More...
 
 ArrayOfDoubleChains (MarkovChainDouble baseChain)
 Same as ArrayOfDoubleChains(baseChain, new RandomShift(new MRG32k3a())).
 
void makeCopies (int n)
 Creates the vector of states for n copies of the base chain.
 
void setStatesDouble (double[] S)
 Sets the states of the n copies of the base chain to S.
 
double [] getStatesDouble ()
 Returns the array containing the states of the n chains.
 
void initStatesDouble ()
 Initializes the states of the n copies of the base chain.
 
boolean simulOneStepArrayRQMC (int step, PointSet p)
 Simulate one step for the n copies of the base chain, assuming that we are at step step. More...
 
double simulArrayRQMC (PointSet p, int numSteps)
 Simulates the \(n\) copies of the chain, numSteps steps for each copy, using point set p, where \(n\) is the current number of copies of the chain and is assumed to equal the number of points in p. More...
 
double calcMeanPerf ()
 Computes and returns the mean performance of the \(n\) chains.
 
void sortChains ()
 Sorts the arrays containing the states of the \(n\) chains.
 
String toString ()
 Creates a String with the states.
 
- Public Member Functions inherited from ArrayOfComparableChains< T extends MarkovChainComparable >
 ArrayOfComparableChains (T baseChain)
 Creates an array of the comparable chain baseChain. More...
 
 ArrayOfComparableChains (T baseChain, PointSetRandomization rand, MultiDimSort sort)
 Creates an array of the comparable chain baseChain. More...
 
void makeCopies (int n)
 Creates n copies (clones) of the chain baseChain and puts them in an array, ready for the array RQMC simulation.
 
void initialStates ()
 Initializes the n copies (clones) of the chain baseChain to their initial state by calling initialState() on each chain.
 
int getN ()
 Returns the number n of chains.
 
T [] getChains ()
 Returns the underlying array of n MarkovChainComparable.
 
void setRandomization (PointSetRandomization rand)
 Sets the internal umontreal.ssj.hups.PointSetRandomization to rand.
 
PointSetRandomization getRandomization ()
 Returns the internal umontreal.ssj.hups.PointSetRandomization.
 
void setSort (MultiDimSort sort)
 Sets the internal umontreal.ssj.util.MultiDimSort to sort.
 
MultiDimSort getSort ()
 Returns the saved umontreal.ssj.util.MultiDimSort.
 
int simulOneStepArrayRQMC (PointSet p, PointSetRandomization rand, MultiDimSort sort, int sortCoordPts)
 Randomized the point set p and Simulates the \(n\) copies of the chain, one step for each copy, using umontreal.ssj.hups.PointSet p, where \(n\) is the current number of copies (clones) of the chain and is assumed to equal the number of points in p. More...
 
int simulOneStepArrayRQMC (PointSet p)
 This version uses the preselected randomization and sort, with sortCoordPts = 0.
 
double simulArrayRQMC (PointSet p, PointSetRandomization rand, MultiDimSort sort, int sortCoordPts, int numSteps)
 Simulates the \(n\) copies of the chain, numSteps steps for each copy, using umontreal.ssj.hups.PointSet p, where \(n\) is the current number of copies (clones) of the chain and is assumed to equal the number of points in p. More...
 
double simulArrayRQMC (PointSet p, PointSetRandomization rand, MultiDimSort sort, int numSteps)
 This version assumes that sortCoordPts = 0, so that there is no need to sort the points at each step.
 
double simulArrayRQMC (PointSet p, int numSteps)
 This version assumes that sortCoordPts = 0 and uses the preset randomization and sort for the chains.
 
double [] getPerformances ()
 Returns the vector for performances for the \(n\) chains.
 
double calcMeanPerf ()
 Computes and returns the mean performance of the \(n\) chains.
 
void simulReplicatesArrayRQMC (PointSet p, PointSetRandomization rand, MultiDimSort sort, int sortCoordPts, int numSteps, int m, Tally statReps)
 Performs m independent replications of an array-RQMC simulation as in simulArrayRQMC. More...
 
String simulReplicatesArrayRQMCFormat (PointSet p, PointSetRandomization rand, MultiDimSort sort, int sortCoordPts, int numSteps, int m, Tally statReps)
 Performs m independent replications of an array-RQMC simulation as in simulFormatArrayRQMC. More...
 
String varianceImprovementFormat (double varRQMC, double varMC)
 Returns a string that reports the the ratio of MC variance per run varMC over the RQMC variance per run varRQMC.
 
String testVarianceRateFormat (PointSet[] pointSets, PointSetRandomization rand, MultiDimSort sort, int sortCoordPts, int numSteps, int m, double varMC, String filenamePlot, String methodLabel)
 Performs an experiment to estimate the convergence rate of the RQMC variance as a function of \(n\), by invoking #simulReplicatesArrayRQMC(r) epeatedly with a given array of point sets of different sizes \(n\). More...
 
void sortNotStoppedChains (MultiDimSort sort)
 Sorts the chains that have not stopped yet using the stored umontreal.ssj.util.MultiDimSort. More...
 
void sortChains ()
 Sorts the chains using the stored umontreal.ssj.util.MultiDimSort.
 
String formatTime (double time)
 
double slope (double[] x, double[] y, int n)
 

Protected Attributes

MarkovChainDouble baseChain
 
double [] state
 
double [] perfState
 
- Protected Attributes inherited from ArrayOfComparableChains< T extends MarkovChainComparable >
baseChain
 
int n
 
T [] chains
 
double [] performances
 
PointSetRandomization randomization
 
MultiDimSort< T > savedSort
 
int sortCoordPts = 0
 

Detailed Description

Similar to ArrayOfComparableChains, except that instead of working with \(n\) clones of a MarkovChain, we use a single MarkovChainDouble object for all the chains.

The states of the chains are maintained in an array of real numbers (double) and the MarkovChainDouble.nextStepDouble method is used to advance each chain by one step. The performance measure is assumed to be additive over all steps of all copies of the chain. The sum is cumulated in a single accumulator for all copies of the chain, updated at each step of each copy.

Constructor & Destructor Documentation

◆ ArrayOfDoubleChains()

Creates a virtual array for the chain baseChain.

The method makeCopies must be called to make the copies.

Member Function Documentation

◆ simulArrayRQMC()

double simulArrayRQMC ( PointSet  p,
int  numSteps 
)

Simulates the \(n\) copies of the chain, numSteps steps for each copy, using point set p, where \(n\) is the current number of copies of the chain and is assumed to equal the number of points in p.

At each step, the points are randomized using the stored umontreal.ssj.hups.PointSetRandomization. The dimension of p must be at least as large as the number of uniforms required to simulate one step of the chain. Returns the average performance per run.

◆ simulOneStepArrayRQMC()

boolean simulOneStepArrayRQMC ( int  step,
PointSet  p 
)

Simulate one step for the n copies of the base chain, assuming that we are at step step.

The points are randomized before the simulation using the stored umontreal.ssj.hups.PointSetRandomization. The dimension of p must be at least as large as the number of uniforms required to simulate one step of the chain. Returns true if and only if all chains have stopped. Compute and stores the performances.


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