|
SSJ V. labo. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.markovchain.MarkovChain
umontreal.iro.lecuyer.markovchain.MarkovChainComparable
umontreal.iro.lecuyer.markovchain.MarkovChainDouble
public abstract class MarkovChainDouble
A special kind of Markov chain whose state space is a subset of the real numbers. The state is stored in the double variable state.
The ``Double'' version of the methods from Markov Chain now returns the state. This makes it possible to simulate several copies of this chain in parallel without cloning and without maintaining the state of the chain in a local variable. The states can be maintained in an external array and at each step, one passes the current state to the method nextStepDouble, which returns the next state. This is exploited in the implementation of ArrayOfDoubleChains.
The methods initialState
, nextStep
,
getPerformance
and compareTo
, which are abstract in
MarkovChainComparable
, all have a default implementation
here, so the methods of Markov Chain still work.
On the other hand, the abstract methods specified in the present class do not necessarily update local variables.
Abstract method compareTo from class MarkovChainComparable is implemented by comparing variable state of the chains. And method dimension now returns 1, there's no need to set variable stateDim.
Constructor Summary | |
---|---|
MarkovChainDouble()
|
Method Summary | |
---|---|
int |
compareTo(MarkovChainComparable other,
int i)
Compares objects of type T in the i-th dimension. |
int |
dimension()
Returns the dimension of the state. |
double |
getPerformance()
Returns the value of perf which is computed when a chain stops. |
double |
getPerformance(int numSteps)
Returns the performance mesure associated with current state, which may depend on the number of steps numsteps. |
abstract double |
getPerformanceDouble(double state,
int numSteps)
Returns the performance measure associated with state state, which may depend on the number of steps numsteps. |
boolean |
hasStopped()
Indicates if the chain has stopped. |
void |
initialState()
Sets the Markov chain to its (deterministic) initial state and initializes the collectors for the performance measure, ready to start a simulation. |
abstract double |
initialStateDouble()
Returns the initial (deterministic) state. |
void |
nextStep(RandomStream stream)
Simulates one more step of the chain, from its current state, using stream for the randomness. |
abstract double |
nextStepDouble(int step,
double s,
RandomStream stream)
Simulates one step of the chain, from state s, using stream for the randomness, assuming we are at step step. |
void |
simulRunsWithSubstreams(int n,
int numSteps,
RandomStream stream,
Tally statRuns)
Same as simulRuns , except that the stream is first reset to
its initial seed and then reset to the first substream at the beginning
and to the next substream after each run. |
double |
simulStepsDouble(int numSteps,
RandomStream stream)
After invoking initialStateDouble , starts a new simulation run,
simulates numSteps steps of the
Markov chain using the given stream, and returns the final state. |
Methods inherited from class umontreal.iro.lecuyer.markovchain.MarkovChain |
---|
clone, formatResults, formatResultsRQMC, simulRQMC, simulRQMC, simulRQMCFormat, simulRuns, simulRunsFormat, simulRunsWithSubstreamsFormat, simulSteps, simulSteps, testImprovementRQMC |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MarkovChainDouble()
Method Detail |
---|
public abstract double initialStateDouble()
public void initialState()
MarkovChain
initialState
in class MarkovChain
public abstract double nextStepDouble(int step, double s, RandomStream stream)
public void nextStep(RandomStream stream)
MarkovChain
nextStep
in class MarkovChain
public abstract double getPerformanceDouble(double state, int numSteps)
public double getPerformance(int numSteps)
public double getPerformance()
getPerformance
in class MarkovChain
public boolean hasStopped()
hasStopped
in class MarkovChain
public int dimension()
MarkovChainComparable
dimension
in interface MultiDimComparable<MarkovChainComparable>
dimension
in class MarkovChainComparable
public int compareTo(MarkovChainComparable other, int i)
MultiDimComparable
dimension()
, then this method should throw an
IllegalArgumentException
.
public double simulStepsDouble(int numSteps, RandomStream stream)
initialStateDouble
, starts a new simulation run,
simulates numSteps steps of the
Markov chain using the given stream, and returns the final state.
The simulSteps
method in MarkovChain does the same, but returns nothing.
public void simulRunsWithSubstreams(int n, int numSteps, RandomStream stream, Tally statRuns)
simulRuns
, except that the stream is first reset to
its initial seed and then reset to the first substream at the beginning
and to the next substream after each run.
simulRunsWithSubstreams
in class MarkovChain
|
SSJ V. labo. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |