|
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
public abstract class MarkovChain
This class defines a generic Markov chain and provides basic tools to simulate it for a given number of steps or until it stops and recover the performance measure. Chains can be cloned, so one can simulate many replicates in parallel.
In a concrete subclass, it suffices to implement the three
abstract methods
initialState
(),
nextStep
(stream)
and
getPerformance
()
to get things going. Though it is recommended to implement
subclasses of MarkovChainComparable
or
MarkovChainDouble
rather than directly from this class.
Some other methods are then needed.
Also, it is VERY IMPORTANT to override the method clone
,
if the class contains non primitive objects, in order to clone these
objects.
Methods of this class simulates the chain over a certain number of steps using Monte Carlo methods or randomized quasi-Monte Carlo. Statistics for the performance mesure of the chain are computed during these simulations.
Constructor Summary | |
---|---|
MarkovChain()
|
Method Summary | |
---|---|
Object |
clone()
Returns a clone of the chain. |
String |
formatResults(Tally stat)
Returns a string containing the mean, the variance, and a 90% confidence interval for stat. |
String |
formatResultsRQMC(Tally stat,
int numPoints)
Returns a string containing the mean, the variance multiplied by numPoints, and a 90% confidence interval for stat. |
abstract double |
getPerformance()
Returns the performance measure (total or average cost or gain) so far, for the current simulation run. |
boolean |
hasStopped()
Tells if the chain has stopped. |
abstract 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 void |
nextStep(RandomStream stream)
Simulates one more step of the chain, from its current state, using stream for the randomness. |
void |
simulRQMC(PointSet p,
int m,
int numSteps,
PointSetRandomization rand,
Tally statReps)
Performs m independent replicates of n simulation runs of the chain using a RQMC point set, each time storing the average of the performance over the n chains. |
void |
simulRQMC(PointSet p,
int m,
int numSteps,
RandomStream noise,
Tally statReps)
Deprecated. |
String |
simulRQMCFormat(PointSet p,
int m,
int numSteps,
RandomStream noise,
Tally statReps)
Same as simulRQMC but also returns the results as a formatted string. |
void |
simulRuns(int n,
int numSteps,
RandomStream stream,
Tally statRuns)
Performs n simulation runs of the chain, for numSteps steps per run, using the given stream. |
String |
simulRunsFormat(int n,
int numSteps,
RandomStream stream,
Tally statRuns)
Same as simulRuns but also returns the results as a formatted string. |
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. |
String |
simulRunsWithSubstreamsFormat(int n,
int numSteps,
RandomStream stream,
Tally statRuns)
Same as simulRunsWithSubstreams but also returns the results
as a formatted string. |
void |
simulSteps(int numSteps,
RandomStream stream)
Starts a new simulation run and simulates numSteps steps of the Markov chain or until the chain stops, using the given stream. |
void |
simulSteps(RandomStream stream)
Starts a new simulation run and simulates until the stopping time is reached, using the given stream. |
String |
testImprovementRQMC(PointSet p,
int m,
int numSteps,
RandomStream noise,
double varMC,
Tally statReps)
Similar to simulRQMCFormat , but also gives the
variance improvement factor with respect to MC. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MarkovChain()
Method Detail |
---|
public abstract void initialState()
public abstract void nextStep(RandomStream stream)
public abstract double getPerformance()
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public boolean hasStopped()
public void simulSteps(int numSteps, RandomStream stream)
public void simulSteps(RandomStream stream)
simulSteps
(Integer.MAX_VALUE, stream).
public void simulRuns(int n, int numSteps, RandomStream stream, Tally statRuns)
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.
public void simulRQMC(PointSet p, int m, int numSteps, PointSetRandomization rand, Tally statReps)
@Deprecated public void simulRQMC(PointSet p, int m, int numSteps, RandomStream noise, Tally statReps)
simulRQMC
.
Simply calls
simulRQMC
(p, m, numSteps, new RandomShift(noise), statReps), so that the
randomization is a random shift.
public String simulRunsFormat(int n, int numSteps, RandomStream stream, Tally statRuns)
simulRuns
but also returns the results as a formatted string.
public String simulRunsWithSubstreamsFormat(int n, int numSteps, RandomStream stream, Tally statRuns)
simulRunsWithSubstreams
but also returns the results
as a formatted string.
public String simulRQMCFormat(PointSet p, int m, int numSteps, RandomStream noise, Tally statReps)
simulRQMC
but also returns the results as a formatted string.
public String testImprovementRQMC(PointSet p, int m, int numSteps, RandomStream noise, double varMC, Tally statReps)
simulRQMCFormat
, but also gives the
variance improvement factor with respect to MC. Assuming that
varMC gives the variance per run for MC.
public String formatResults(Tally stat)
public String formatResultsRQMC(Tally stat, int numPoints)
|
SSJ V. labo. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |