SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.mcqmctools.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 umontreal.ssj.mcqmctools.MonteCarloExperiment:
umontreal.ssj.mcqmctools.RQMCExperiment

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.
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.
static void simulateRunsCV (MonteCarloModelCV model, int n, RandomStream stream, ListOfTalliesWithCV< TallyStore > statWithCV)
 Performs n runs of model using #stream and collects statistics for a model with a vector of control variates.
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.
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.
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.
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.
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< TallyStore > statWithCV, double level, int d, Chrono timer)
 Similar to simulateRunsDefaultReport, but this one uses a vector of control variates.
static String simulateRunsDefaultReportCV (MonteCarloModelCV model, int n, RandomStream stream, ListOfTalliesWithCV< TallyStore > 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.

Definition at line 20 of file MonteCarloExperiment.java.

Member Function Documentation

◆ computeMeanVarCV()

void umontreal.ssj.mcqmctools.MonteCarloExperiment.computeMeanVarCV ( TallyStore statX,
TallyStore statC,
double[] mean,
double[] variance )
static

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.

Definition at line 112 of file MonteCarloExperiment.java.

◆ simulateRuns() [1/2]

void umontreal.ssj.mcqmctools.MonteCarloExperiment.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.

Definition at line 27 of file MonteCarloExperiment.java.

◆ simulateRuns() [2/2]

void umontreal.ssj.mcqmctools.MonteCarloExperiment.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.

Definition at line 49 of file MonteCarloExperiment.java.

◆ simulateRunsCV() [1/3]

void umontreal.ssj.mcqmctools.MonteCarloExperiment.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.

Definition at line 97 of file MonteCarloExperiment.java.

◆ simulateRunsCV() [2/3]

void umontreal.ssj.mcqmctools.MonteCarloExperiment.simulateRunsCV ( MonteCarloModelCV model,
int n,
RandomStream stream,
ListOfTalliesWithCV< TallyStore > 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.

Definition at line 63 of file MonteCarloExperiment.java.

◆ simulateRunsCV() [3/3]

void umontreal.ssj.mcqmctools.MonteCarloExperiment.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.

Definition at line 78 of file MonteCarloExperiment.java.

◆ simulateRunsDefaultReportCV() [1/3]

String umontreal.ssj.mcqmctools.MonteCarloExperiment.simulateRunsDefaultReportCV ( MonteCarloModelCV model,
int n,
RandomStream stream,
double[] mean,
double[] variance,
double level,
int d,
Chrono timer )
static

This one uses a single real-valued CV, as in simulateRunsCV.

Definition at line 254 of file MonteCarloExperiment.java.

◆ simulateRunsDefaultReportCV() [2/3]

String umontreal.ssj.mcqmctools.MonteCarloExperiment.simulateRunsDefaultReportCV ( MonteCarloModelCV model,
int n,
RandomStream stream,
ListOfTalliesWithCV< TallyStore > statWithCV,
double level,
int d )
static

In this one the timer is created internally (and cannot be accessed externally).

Definition at line 246 of file MonteCarloExperiment.java.

◆ simulateRunsDefaultReportCV() [3/3]

String umontreal.ssj.mcqmctools.MonteCarloExperiment.simulateRunsDefaultReportCV ( MonteCarloModelCV model,
int n,
RandomStream stream,
ListOfTalliesWithCV< TallyStore > 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.

Definition at line 220 of file MonteCarloExperiment.java.

◆ simulateRunsDefaultReportStudent() [1/4]

String umontreal.ssj.mcqmctools.MonteCarloExperiment.simulateRunsDefaultReportStudent ( MonteCarloModelDouble model,
int n,
RandomStream stream,
Tally statValue )
static

A short-hand equivalent for simulateRunsDefaultReportStudent (model, n, stream, statValue, 0.95, 4).

Definition at line 210 of file MonteCarloExperiment.java.

◆ simulateRunsDefaultReportStudent() [2/4]

String umontreal.ssj.mcqmctools.MonteCarloExperiment.simulateRunsDefaultReportStudent ( MonteCarloModelDouble model,
int n,
RandomStream stream,
Tally statValue,
Chrono timer )
static

A short-hand equivalent for simulateRunsDefaultReportStudent (model, n, stream, statValue, 0.95, 4, timer).

Definition at line 201 of file MonteCarloExperiment.java.

◆ simulateRunsDefaultReportStudent() [3/4]

String umontreal.ssj.mcqmctools.MonteCarloExperiment.simulateRunsDefaultReportStudent ( MonteCarloModelDouble model,
int n,
RandomStream stream,
Tally statValue,
double level,
int d )
static

In this version, there is no need to provide a Chrono; it is created inside.

Definition at line 192 of file MonteCarloExperiment.java.

◆ simulateRunsDefaultReportStudent() [4/4]

String umontreal.ssj.mcqmctools.MonteCarloExperiment.simulateRunsDefaultReportStudent ( MonteCarloModelDouble model,
int n,
RandomStream stream,
Tally statValue,
double level,
int d,
Chrono timer )
static

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.

Definition at line 172 of file MonteCarloExperiment.java.

◆ simulFDReplicatesCRN()

void umontreal.ssj.mcqmctools.MonteCarloExperiment.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.

Definition at line 134 of file MonteCarloExperiment.java.

◆ simulFDReplicatesIRN()

void umontreal.ssj.mcqmctools.MonteCarloExperiment.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.

Definition at line 153 of file MonteCarloExperiment.java.


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