SSJ
V. labo.

umontreal.iro.lecuyer.markovchain
Class ArrayOfDoubleChains

java.lang.Object
  extended by umontreal.iro.lecuyer.markovchain.ArrayOfComparableChains
      extended by umontreal.iro.lecuyer.markovchain.ArrayOfDoubleChains
Direct Known Subclasses:
ArrayOfDoubleChainsStop

public class ArrayOfDoubleChains
extends ArrayOfComparableChains

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 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 Summary
ArrayOfDoubleChains(MarkovChainDouble baseChain)
          Same as ArrayOfDoubleChains (baseChain, new RandomShift(new MRG32k3a())).
ArrayOfDoubleChains(MarkovChainDouble baseChain, PointSetRandomization rand)
          Creates a virtual array for the chain baseChain.
 
Method Summary
 double calcMeanPerf()
          Computes and returns the mean performance of the n chains.
 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.
 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 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.
 boolean simulOneStepArrayRQMC(int step, PointSet p)
          Simulate one step for the n copies of the base chain, assuming that we are at step step.
 void sortChains()
          Sorts the arrays containing the states of the n chains.
 String toString()
          Creates a String with the states.
 
Methods inherited from class umontreal.iro.lecuyer.markovchain.ArrayOfComparableChains
getChains, getN, getPerformances, getRandomization, getSort, initialStates, setRandomization, setSort, simulOneStepArrayRQMC, simulReplicatesArrayRQMC, sortNotStoppedChains, testImprovementArrayRQMC
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayOfDoubleChains

public ArrayOfDoubleChains(MarkovChainDouble baseChain,
                           PointSetRandomization rand)
Creates a virtual array for the chain baseChain. The method makeCopies must be called to make the copies.


ArrayOfDoubleChains

public ArrayOfDoubleChains(MarkovChainDouble baseChain)
Same as ArrayOfDoubleChains (baseChain, new RandomShift(new MRG32k3a())).

Method Detail

makeCopies

public void makeCopies(int n)
Creates the vector of states for n copies of the base chain.

Overrides:
makeCopies in class ArrayOfComparableChains

setStatesDouble

public void setStatesDouble(double[] S)
Sets the states of the n copies of the base chain to S.


getStatesDouble

public double[] getStatesDouble()
Returns the array containing the states of the n chains.


initStatesDouble

public void initStatesDouble()
Initializes the states of the n copies of the base chain.


simulOneStepArrayRQMC

public 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 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.


simulArrayRQMC

public 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 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.

Overrides:
simulArrayRQMC in class ArrayOfComparableChains

calcMeanPerf

public double calcMeanPerf()
Computes and returns the mean performance of the n chains.

Overrides:
calcMeanPerf in class ArrayOfComparableChains

sortChains

public void sortChains()
Sorts the arrays containing the states of the n chains.

Overrides:
sortChains in class ArrayOfComparableChains

toString

public String toString()
Creates a String with the states.

Overrides:
toString in class Object

SSJ
V. labo.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.