SSJ  3.3.1
Stochastic Simulation in Java
Static Public Member Functions | List of all members
MonteCarloExperiment Class Reference

Provides generic tools to perform simple Monte Carlo experiments with a simulation model that implements one of the interfaces MonteCarloModelDouble, MonteCarloModelDoubleArray, or MonteCarloModelCV. More...

Inheritance diagram for MonteCarloExperiment:
[legend]

Static Public Member Functions

static void simulateRuns (MonteCarloModelDouble model, int n, RandomStream stream, Tally statValue)
 Performs #n simulation runs of #model using #stream and collects statistics in #statValue. More...
 
static void simulateRuns (MonteCarloModelDoubleArray model, int n, RandomStream stream, ListOfTallies<? extends Tally > statValueList)
 Similar to simulateRuns(MonteCarloModelDouble, int, RandomStream, Tally) but for a model of type MonteCarloModelDoubleArray. More...
 
static void simulateRunsCV (MonteCarloModelCV model, int n, RandomStream stream, ListOfTalliesWithCV< Tally > statWithCV)
 Performs n runs of model using #stream and collects statistics for a model with a vector of control variates. More...
 
static void simulateRunsCV (MonteCarloModelCV model, int n, RandomStream stream, TallyStore statX, TallyStore statC)
 Performs n runs using stream and collects statistics for a model with a single real-valued control variate C. More...
 
static void simulateRunsCV (MonteCarloModelCV model, int n, RandomStream stream, double[] mean, double[] variance)
 
Performs n runs using #stream and collects statistics for a model with a single real-valued control variate C. More...
 
static void computeMeanVarCV (TallyStore statX, TallyStore statC, double[] mean, double[] variance)
 Given statistics collected in statX and statC as with simulateRunsCV, this method computes the mean and variance of the estimators with and without the CV and returns them in the two-dimensional vectors mean and variance (mean[0] is the value without CV, mean[1] the value with CV, and similarly for the variance.
 
static void simulFDReplicatesCRN (MonteCarloModelDouble model1, MonteCarloModelDouble model2, double delta, int n, RandomStream stream, Tally statDiff)
 Performs n simulation runs to estimate the difference in performance between model2 and model1, divided by delta, using common random numbers (CRN) across the two models. More...
 
static void simulFDReplicatesIRN (MonteCarloModelDouble model1, MonteCarloModelDouble model2, double delta, int n, RandomStream stream, Tally statDiff)
 Similar to simulFDReplicatesCRN, but using independent random numbers (IRN) across the two models. More...
 
static String simulateRunsDefaultReportStudent (MonteCarloModelDouble model, int n, RandomStream stream, Tally statValue, double level, int d, Chrono timer)
 Performs n independent runs using n substreams of #stream, collects statistics in #statValue, and returns a report with a confidence interval of level #level, with d decimal fractional digits of precision for the output, computed via a Student distribution.
 
static String simulateRunsDefaultReportStudent (MonteCarloModelDouble model, int n, RandomStream stream, Tally statValue, double level, int d)
 In this version, there is no need to provide a Chrono; it is created inside.
 
static String simulateRunsDefaultReportStudent (MonteCarloModelDouble model, int n, RandomStream stream, Tally statValue, Chrono timer)
 A short-hand equivalent for simulateRunsDefaultReportStudent (model, n, stream, statValue, 0.95, 4, timer)
 
static String simulateRunsDefaultReportStudent (MonteCarloModelDouble model, int n, RandomStream stream, Tally statValue)
 A short-hand equivalent for simulateRunsDefaultReportStudent (model, n, stream, statValue, 0.95, 4)
 
static String simulateRunsDefaultReportCV (MonteCarloModelCV model, int n, RandomStream stream, ListOfTalliesWithCV< Tally > statWithCV, double level, int d, Chrono timer)
 Similar to simulateRunsDefaultReport, but this one uses a vector of control variates. More...
 
static String simulateRunsDefaultReportCV (MonteCarloModelCV model, int n, RandomStream stream, ListOfTalliesWithCV< Tally > statWithCV, double level, int d)
 In this one the timer is created internally (and cannot be accessed externally).
 
static String simulateRunsDefaultReportCV (MonteCarloModelCV model, int n, RandomStream stream, double[] mean, double[] variance, double level, int d, Chrono timer)
 This one uses a single real-valued CV, as in simulateRunsCV.
 

Detailed Description

Provides generic tools to perform simple Monte Carlo experiments with a simulation model that implements one of the interfaces MonteCarloModelDouble, MonteCarloModelDoubleArray, or MonteCarloModelCV.

The experiment consists of n independent simulation runs and the results are returned in Tally satistical collectors. The RandomStream used for the experiment is reset to a new substream after each run.

Member Function Documentation

◆ simulateRuns() [1/2]

static void simulateRuns ( MonteCarloModelDouble  model,
int  n,
RandomStream  stream,
Tally  statValue 
)
static

Performs #n simulation runs of #model using #stream and collects statistics in #statValue.

The #stream is reset to a new substream for each run.

◆ simulateRuns() [2/2]

static void simulateRuns ( MonteCarloModelDoubleArray  model,
int  n,
RandomStream  stream,
ListOfTallies<? extends Tally statValueList 
)
static

Similar to simulateRuns(MonteCarloModelDouble, int, RandomStream, Tally) but for a model of type MonteCarloModelDoubleArray.

Consequently, the statistics are collected in a ListOfTallies. The \(t\)-th element of #statValueList collects the statistics for the \(t\)-th coordinate of the performance vector of #model.

Parameters
modelthe underlying model.
nthe number of simulation runs
streamthe stream used to simulate the model
statValueListthe collector of the statistical data.

◆ simulateRunsCV() [1/3]

static void simulateRunsCV ( MonteCarloModelCV  model,
int  n,
RandomStream  stream,
ListOfTalliesWithCV< Tally statWithCV 
)
static

Performs n runs of model using #stream and collects statistics for a model with a vector of control variates.

The results are returned in #statWithCV.

◆ simulateRunsCV() [2/3]

static void simulateRunsCV ( MonteCarloModelCV  model,
int  n,
RandomStream  stream,
TallyStore  statX,
TallyStore  statC 
)
static

Performs n runs using stream and collects statistics for a model with a single real-valued control variate C.

The statistics on X and C are collected in statX and statC.

◆ simulateRunsCV() [3/3]

static void simulateRunsCV ( MonteCarloModelCV  model,
int  n,
RandomStream  stream,
double []  mean,
double []  variance 
)
static


Performs n runs using #stream and collects statistics for a model with a single real-valued control variate C.

The statistics are collected, and the mean and variance of the estimators with and without the control variate are returned in the two-dimensional vectors mean and variance, as in computeMeanVarCV.

◆ simulateRunsDefaultReportCV()

static String simulateRunsDefaultReportCV ( MonteCarloModelCV  model,
int  n,
RandomStream  stream,
ListOfTalliesWithCV< Tally statWithCV,
double  level,
int  d,
Chrono  timer 
)
static

Similar to simulateRunsDefaultReport, but this one uses a vector of control variates.

It returns a report with a confidence interval for the estimator with the CV.

◆ simulFDReplicatesCRN()

static void simulFDReplicatesCRN ( MonteCarloModelDouble  model1,
MonteCarloModelDouble  model2,
double  delta,
int  n,
RandomStream  stream,
Tally  statDiff 
)
static

Performs n simulation runs to estimate the difference in performance between model2 and model1, divided by delta, using common random numbers (CRN) across the two models.

One substream is used for each run and the same n substreams are used for the two models. Returns the statistics on the n differences in statDiff. By taking delta = 1, this just estimates the difference. By taking delta > 0 very small, and if the two models are in fact the same model but with a parameter that differs by delta, this gives a finite-difference estimator of the derivative of the performance with respect to this parameter.

◆ simulFDReplicatesIRN()

static void simulFDReplicatesIRN ( MonteCarloModelDouble  model1,
MonteCarloModelDouble  model2,
double  delta,
int  n,
RandomStream  stream,
Tally  statDiff 
)
static

Similar to simulFDReplicatesCRN, but using independent random numbers (IRN) across the two models.

One substream is used for each run of each model, for a total of 2n substreams.


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