This class provides tools to simulate an array of. More...
Public Member Functions | |
| ArrayOfComparableChains (T baseChain) | |
| Creates an array of the comparable chain baseChain. | |
| ArrayOfComparableChains (T baseChain, PointSetRandomization rand, MultiDimSort< T > sort) | |
| Creates an array of the comparable chain baseChain. | |
| 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< T > sort) |
| Sets the internal umontreal.ssj.util.MultiDimSort to sort. | |
| MultiDimSort< T > | getSort () |
| Returns the saved umontreal.ssj.util.MultiDimSort. | |
| int | simulOneStepArrayRQMC (PointSet p, PointSetRandomization rand, MultiDimSort< T > sort, int sortCoordPts) |
| Randomized the point set p and Simulates the \(n\) copies of the chain, one step for each copy, using. | |
| int | simulOneStepArrayRQMC (PointSet p) |
| This version uses the preselected randomization and sort, with sortCoordPts
= 0. | |
| double | simulArrayRQMC (PointSet p, PointSetRandomization rand, MultiDimSort< T > 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. | |
| double | simulArrayRQMC (PointSet p, PointSetRandomization rand, MultiDimSort< T > 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< T > sort, int sortCoordPts, int numSteps, int m, Tally statReps) |
| Performs m independent replications of an array-RQMC simulation as in simulArrayRQMC. | |
| String | simulReplicatesArrayRQMCFormat (PointSet p, PointSetRandomization rand, MultiDimSort< T > sort, int sortCoordPts, int numSteps, int m, Tally statReps) |
| Performs m independent replications of an array-RQMC simulation as in simulFormatArrayRQMC. | |
| 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< T > 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\). | |
| String | testVarianceRateFormat (RQMCPointSet[] rqmcPts, MultiDimSort< T > sort, int sortCoordPts, int numSteps, int m, double varMC, String filenamePlot, String methodLabel) |
| Same as above, but produces a plot of the mean and the variance as a function of the step. | |
| void | sortNotStoppedChains (MultiDimSort< T > sort) |
| Sorts the chains that have not stopped yet using the stored. | |
| void | sortChains () |
| Sorts the chains using the stored. | |
Public Attributes | |
| Tally[] | performancePerRun |
| Performance measure at each step of the chain. | |
This class provides tools to simulate an array of.
MarkovChainComparable objects with the array-RQMC method of [134], [136] . It offers tools to construct the array of chains, simulate with array-RQMC for one step or multiple steps, perform experiments, and report some results.
The method simulates \(n\) realizations of a Markov chain having an \(\ell\)-dimensional state. At each step, the \(n\) states are sorted in some way and then advance to the next state by using the RQMC points. If \(\ell=1\), we just une an ordinary sort. If \(\ell> 1\), there are two possibilities. The first one is to define a mapping from the state space to the real numbers, called a sorting function, and sort according to the value of this sorting function. We end up sorting in \(\ell’=1\) dimensions. The second possibility is to use a multivariate sort of the type umontreal.ssj.util.multidimsort.MultiDimSort, which in general can sort umontreal.ssj.util.multidimsort.MultiDimComparable objects. Special cases of these multivariate sorts are of type umontreal.ssj.util.multidimsort.MultiDimSort01. Some of them effectively map the chain states to the one-dimensional interval \((0,1)\). For example, the sorts based on a Hilbert curve, such as umontreal.ssj.util.multidimsort.HilbertCurveSort, do that. In that case, we end up again sorting in \(\ell’=1\) dimensions. Otherwise, we sort in \(\ell’ \leq \ell\) dimensions.
To move the chains ahead, we use an \((\ell’+d)\)-dimensional RQMC umontreal.ssj.hups.PointSet. The first \(\ell’\) coordinates are used to sort the points in the same way as the states of the chains, to match each point with a state and vice-versa.
When \(\ell’=1\), we are also allowed to use only \(d\)-dimensional RQMC points exactly as in ArrayOfDoubleChains. That is, the points are assumed to be already sorted by a virtual coordinate which is not stored explicitly, and can be assumed to be \(i/n\) for state \(i\). In this case, we can take for example the first \(n\) points of a Sobol’ sequence, or a rank-1 lattice for which the first coordinate is dropped. To choose this option, we must pass sortCoordPts=0 when running the Array-RQMC simulations. Otherwise, the points will be sorted by their first sortCoordPts coordinates, where sortCoordPts should be the value of \(\ell’\). When sortCoordPts > 0, the current implementation also imposes that the point set is a umontreal.ssj.hups.CachedPointSet, and the RQMC points are sorted at each step. This constraint can be satisfied by using a umontreal.ssj.hups.SortedAndCutPointSet.
At each step the RQMC points are randomized using a @ref umontreal.ssj.hups.PointSetRandomization. There are types of point sets for which only the last @f$d@f$ coordinates have to be randomized (e.g., digital nets and lattice rules) and others for which all @f$\ell’ + d@f$ coordinates must be randomized (e.g., a stratified sample). <div class="SSJ-bigskip"></div><div class="SSJ-bigskip"></div>
Definition at line 74 of file ArrayOfComparableChains.java.
| umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.ArrayOfComparableChains | ( | T | baseChain | ) |
Creates an array of the comparable chain baseChain.
The method makeCopies(int) must be called afterward to make the actual copies of the chain.
Definition at line 94 of file ArrayOfComparableChains.java.
| umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.ArrayOfComparableChains | ( | T | baseChain, |
| PointSetRandomization | rand, | ||
| MultiDimSort< T > | sort ) |
Creates an array of the comparable chain baseChain.
The method makeCopies(int) must be called to make the copies. rand will be used to randomize the point sets in the simulations. sort will be used to sort the chains.
Definition at line 105 of file ArrayOfComparableChains.java.
| double umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.calcMeanPerf | ( | ) |
Computes and returns the mean performance of the \(n\) chains.
Reimplemented in umontreal.ssj.markovchainrqmc.ArrayOfDoubleChains.
Definition at line 333 of file ArrayOfComparableChains.java.
| T[] umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.getChains | ( | ) |
Returns the underlying array of n MarkovChainComparable.
Definition at line 159 of file ArrayOfComparableChains.java.
| int umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.getN | ( | ) |
Returns the number n of chains.
Definition at line 152 of file ArrayOfComparableChains.java.
| double[] umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.getPerformances | ( | ) |
Returns the vector for performances for the \(n\) chains.
Definition at line 326 of file ArrayOfComparableChains.java.
| PointSetRandomization umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.getRandomization | ( | ) |
Returns the internal umontreal.ssj.hups.PointSetRandomization.
Definition at line 173 of file ArrayOfComparableChains.java.
| MultiDimSort< T > umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.getSort | ( | ) |
Returns the saved umontreal.ssj.util.MultiDimSort.
Definition at line 187 of file ArrayOfComparableChains.java.
| void umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.initialStates | ( | ) |
Initializes the n copies (clones) of the chain baseChain to their initial state by calling initialState() on each chain.
Definition at line 140 of file ArrayOfComparableChains.java.
| void umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.makeCopies | ( | int | n | ) |
Creates n copies (clones) of the chain baseChain and puts them in an array, ready for the array RQMC simulation.
Reimplemented in umontreal.ssj.markovchainrqmc.ArrayOfDoubleChains.
Definition at line 117 of file ArrayOfComparableChains.java.
| void umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.setRandomization | ( | PointSetRandomization | rand | ) |
Sets the internal umontreal.ssj.hups.PointSetRandomization to rand.
Definition at line 166 of file ArrayOfComparableChains.java.
| void umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.setSort | ( | MultiDimSort< T > | sort | ) |
Sets the internal umontreal.ssj.util.MultiDimSort to sort.
Definition at line 180 of file ArrayOfComparableChains.java.
| double umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.simulArrayRQMC | ( | PointSet | p, |
| int | numSteps ) |
This version assumes that sortCoordPts = 0 and uses the preset randomization and sort for the chains.
Reimplemented in umontreal.ssj.markovchainrqmc.ArrayOfDoubleChains.
Definition at line 319 of file ArrayOfComparableChains.java.
| double umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.simulArrayRQMC | ( | PointSet | p, |
| PointSetRandomization | rand, | ||
| MultiDimSort< T > | sort, | ||
| int | numSteps ) |
This version assumes that sortCoordPts = 0, so that there is no need to sort the points at each step.
Definition at line 311 of file ArrayOfComparableChains.java.
| double umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.simulArrayRQMC | ( | PointSet | p, |
| PointSetRandomization | rand, | ||
| MultiDimSort< T > | 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.
At each step, the points are randomized using rand. All coordinates are randomized. If sortCoordPts \(>0\), the points are also sorted explicitly based on their first sortCoordPts coordinates, at each step, after they are randomized. In that case, p must implement the
umontreal.ssj.util.MultiDim01 interface. If the coordinates used for the sort do not have to be randomized at each step and the points do not have to be sorted again, one should remove these coordinates before invoking this method and use sortCoordPts=0. In this case, the points must be sorted before invoking this method. The class umontreal.ssj.hups.SortedAndCutPointSet can be useful for this. The dimension of p must be at least as large as sortCoordPts \(+\) the number of uniforms required to simulate one step of the chain. The method returns the average performance per run. An array that contains the performance for each run can also be obtained via getPerformances()(.)
Definition at line 267 of file ArrayOfComparableChains.java.
| int umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.simulOneStepArrayRQMC | ( | PointSet | p | ) |
This version uses the preselected randomization and sort, with sortCoordPts = 0.
Definition at line 242 of file ArrayOfComparableChains.java.
| int umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.simulOneStepArrayRQMC | ( | PointSet | p, |
| PointSetRandomization | rand, | ||
| MultiDimSort< T > | 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. The points are randomized before the simulation using the stored umontreal.ssj.hups.PointSetRandomization. If sortCoordPts \(>0\), the points are also sorted explicitly based on their first sortCoordPts coordinates, at each step, after they are randomized. In that case, p must implement the umontreal.ssj.util.MultiDim01 interface. The dimension of p must be at least as large as sortCoordPts \(+\) the number of uniforms required to simulate one step of the chain. Returns the number of chains that have not stopped yet.
Definition at line 208 of file ArrayOfComparableChains.java.
| void umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.simulReplicatesArrayRQMC | ( | PointSet | p, |
| PointSetRandomization | rand, | ||
| MultiDimSort< T > | sort, | ||
| int | sortCoordPts, | ||
| int | numSteps, | ||
| int | m, | ||
| Tally | statReps ) |
Performs m independent replications of an array-RQMC simulation as in simulArrayRQMC.
The statistics on the m corresponding averages are collected in statReps.
Definition at line 346 of file ArrayOfComparableChains.java.
| String umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.simulReplicatesArrayRQMCFormat | ( | PointSet | p, |
| PointSetRandomization | rand, | ||
| MultiDimSort< T > | sort, | ||
| int | sortCoordPts, | ||
| int | numSteps, | ||
| int | m, | ||
| Tally | statReps ) |
Performs m independent replications of an array-RQMC simulation as in simulFormatArrayRQMC.
The statistics on the m corresponding averages are collected in statReps and the results are also returned in a string.
Definition at line 361 of file ArrayOfComparableChains.java.
| void umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.sortChains | ( | ) |
Sorts the chains using the stored.
umontreal.ssj.util.MultiDimSort.
Reimplemented in umontreal.ssj.markovchainrqmc.ArrayOfDoubleChains.
Definition at line 583 of file ArrayOfComparableChains.java.
| void umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.sortNotStoppedChains | ( | MultiDimSort< T > | sort | ) |
Sorts the chains that have not stopped yet using the stored.
umontreal.ssj.util.MultiDimSort. All the stopped chains are placed at the end, then the chains that have not stopped are sorted.
Definition at line 558 of file ArrayOfComparableChains.java.
| String umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.testVarianceRateFormat | ( | PointSet[] | pointSets, |
| PointSetRandomization | rand, | ||
| MultiDimSort< T > | 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\).
Returns a string that reports the mean, variance, and variance reduction factor (VRF) with respect to MC for each point set, and the estimated convergence rate of the RQMC variance as a function of \(n\). Assumes that varMC is the variance per run for MC. The string methodLabel should be a brief descriptor of the method (e.g., the type of point set, type of randomization, and type of sort). If the string filenamePlot != null, then the method also creates a .tex file with that name that contains a plot in log scale of the variance vs \(n\).
Definition at line 404 of file ArrayOfComparableChains.java.
| String umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.testVarianceRateFormat | ( | RQMCPointSet[] | rqmcPts, |
| MultiDimSort< T > | sort, | ||
| int | sortCoordPts, | ||
| int | numSteps, | ||
| int | m, | ||
| double | varMC, | ||
| String | filenamePlot, | ||
| String | methodLabel ) |
Same as above, but produces a plot of the mean and the variance as a function of the step.
| rqmcPts | |
| sort | |
| sortCoordPts | |
| numSteps | |
| m | |
| varMC | |
| filenamePlot | |
| methodLabel |
Definition at line 463 of file ArrayOfComparableChains.java.
| String umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.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.
Definition at line 384 of file ArrayOfComparableChains.java.
| Tally [] umontreal.ssj.markovchainrqmc.ArrayOfComparableChains< T extends MarkovChainComparable >.performancePerRun |
Performance measure at each step of the chain.
Definition at line 87 of file ArrayOfComparableChains.java.