Package jsl.simulation
Class Simulation
- java.lang.Object
-
- jsl.simulation.Simulation
-
- All Implemented Interfaces:
ObservableIfc,ExperimentGetIfc,IterativeProcessIfc,GetNameIfc
public class Simulation extends java.lang.Object implements ObservableIfc, IterativeProcessIfc, ExperimentGetIfc
Simulation represents a model and experiment that can be run. It encapsulates a model to which model elements can be attached. It allows an experiment and its run parameters to be specified. It allows reporting of results to text files via a SimulationReporter. If you want to store simulation results in a database, then use the JSLDatabaseObserver class to observe the simulation with an instance of the JSLDatabase class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classSimulation.ReplicationExecutionProcessThis class implements the IterativeProcess behavior for the Simulation
-
Constructor Summary
Constructors Constructor Description Simulation()Creates a simulation within a default name using the default executiveSimulation(java.lang.String simName)Creates a simulation to run a model using the default scheduling executive.Simulation(java.lang.String simName, java.nio.file.Path pathToOutputDirectory)Creates a simulation to run a model using the default scheduling executive.Simulation(java.lang.String simName, java.nio.file.Path pathToOutputDirectory, Executive executive)Creates a simulation to run a model using the supplied scheduling executive.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObserver(ObserverIfc observer)Allows an observer to be added to the simulation.protected voidafterExperiment()This method is automatically called at the end of the experiment Sub-classes can inject behavior within hereprotected voidafterReplication()This method is automatically called after each replication Sub-classes can inject behavior within herebooleanallStepsCompleted()Checks if the simulation completed all of its replicationsprotected voidbeforeExperiment()This method is automatically called at the start of the experiment Sub-classes can inject behavior within hereprotected voidbeforeReplication()This method is automatically called before each replication Sub-classes can inject behavior within herebooleancontains(ObserverIfc observer)Returns true if the observer is already attachedintcountObservers()Returns how many observers are currently observing the observablevoiddeleteObserver(ObserverIfc observer)Allows the deletion (removing) of an observer from the observablevoiddeleteObservers()Deletes all the observers from the observablevoidend()Causes the simulation to end after the current replication is completedvoidend(java.lang.String msg)Causes the simulation to end after the current replication is completedbooleanexecutionTimeExceeded()Checks if the simulation stopped because of real clock timebooleangetAdvanceNextSubStreamOption()Returns how many times the random number streams will be advanced before the simulation starts.booleangetAntitheticOption()Indicates whether or not the antithetic streams have been turn on or offlonggetBeginExecutionTime()The absolute time in milliseconds that the simulation was startedintgetCurrentReplicationNumber()Returns the current number of replications completedjava.util.Optional<ExecutiveTraceReport>getDefaultExecutiveTraceReport()Gets a reference to the default event tracing report.longgetElapsedExecutionTime()The time in milliseconds between when the simulation was started and the simulation endedlonggetEndExecutionTime()The absolute time in milliseconds that the simulation endedExecutivegetExecutive()The Executive associated with the simulationExperimentGetIfcgetExperiment()The Experiment associated with the simulationlonggetExperimentId()Returns the id for this objectjava.lang.StringgetExperimentName()Gets the name.booleangetGarbageCollectAfterReplicationFlag()Returns whether or not System.gc() is called after each replicationjava.lang.StringBuildergetHalfWidthSummaryReport()java.lang.StringBuildergetHalfWidthSummaryReport(double confLevel)java.lang.StringBuildergetHalfWidthSummaryReport(java.lang.String title, double confLevel)longgetId()doublegetLengthOfReplication()Provides the length of each replicationdoublegetLengthOfWarmUp()Provides the length of the warm up period for each replicationIPLogReportgetLogReport()Gets the IPLogReport that was attached to the simulationlonggetMaximumAllowedExecutionTime()Returns the real clock time in milliseconds for how long the simulation is allowed to runlonggetMaximumAllowedExecutionTimePerReplication()Gets in real clock time (milliseconds) the amount of time available for each replication within the simulation.ModelgetModel()The Model associated with the simulationjava.lang.StringgetName()intgetNumberOfReplications()Returns the number of replications for the experimentintgetNumberOfStreamAdvancesPriorToRunning()Returns the number of times that the streams should be advanced prior to running the experimentlonggetNumberStepsCompleted()For the IterativeProcessIfc.OutputDirectorygetOutputDirectory()java.nio.file.PathgetOutputDirectoryPath()booleangetRepLengthWarningMessageOption()booleangetReplicationInitializationOption()Returns whether or not replications will be initialized prior to running each replicationbooleangetResetStartStreamOption()Returns whether or not the start stream will be reset prior to executing the simulationjava.util.Optional<StatisticalBatchingElement>getStatisticalBatchingElement()booleangetStoppingFlag()Returns the stopping flagjava.lang.StringgetStoppingMessage()The message supplied with stop()booleanhasMoreReplications()Checks if the current number of replications that have been executed is less than the number of replications specified.booleanhasNextReplication()Returns true if additional replications need to be runvoidinitialize()Initializes the simulation in preparation for runningbooleanisCreated()Checks if the iterative process is in the created state.booleanisDone()Checks if the simulation is done processing replicationsbooleanisEnded()Checks to see if the simulation is in the ended state If it is ended, it may be for a number of reasonsbooleanisExecutionTimeExceeded()Returns if the elapsed execution time exceeds the maximum time allowed.booleanisInitialized()Checks if the simulation has been initialized.booleanisRunning()Checks if the simulation is running.booleanisRunningStep()Indicates that the iterative process is currently running an individual stepbooleanisStepCompleted()Part of the IterativeProcessIfc.booleanisUnfinished()Checks if the replications were finishedSimulationReportermakeSimulationReporter()Constructs a SimulationReporter instance that uses this Simulation instancebooleannoStepsExecuted()Indicates that the iterative process ended because of no stepsLogPrintWriterout()voidprintHalfWidthSummaryReport()Prints the default half-width summary report to the consolevoidprintHalfWidthSummaryReport(double confLevel)voidprintHalfWidthSummaryReport(java.lang.String title, double confLevel)voidrun()Runs all remaining replications based on the current settingsvoidrun(int numReps, double runLength)A convenience method for running a simulationvoidrun(java.lang.String expName, int numReps, double runLength)A convenience method for running a simulationvoidrun(java.lang.String expName, int numReps, double runLength, double warmUp)A convenience method for running a simulationvoidrunNext()Runs the next replication if there is onevoidsetAdvanceNextSubStreamOption(boolean b)Sets the option to have the streams advance to the beginning of the next substream after each replicationvoidsetAdvanceStreamNumber(int n)Sets the number of streams to advance prior to running an experimentprotected voidsetExperiment(Experiment e)Set the simulation experiment to the same attribute values as the supplied experimentvoidsetExperimentName(java.lang.String name)Sets the name of the underlying experimentvoidsetGarbageCollectAfterReplicationFlag(boolean flag)Determines whether or not System.gc() is called after each replicationvoidsetLengthOfReplication(double lengthOfReplication)Sets the length of the replications in simulation time.voidsetLengthOfWarmUp(double lengthOfWarmUp)Allows the length of the warm up period for each replication to be setvoidsetMaximumExecutionTime(long milliseconds)Sets a real clock time for how long the entire simulation can lastvoidsetMaximumExecutionTimePerReplication(long milliseconds)Sets in real clock time (milliseconds) the amount of time available for each replication within the simulation.voidsetNumberOfReplications(int numReps)Sets the number of replications to be executed.voidsetNumberOfReplications(int numReps, boolean antitheticOption)Sets the number of replications to be executed and whether or not the antithetic option is on.voidsetRepLengthWarningMessageOption(boolean flag)False turns off the messagevoidsetReplicationInitializationOption(boolean repInitOption)Sets whether or not the replication should be initialized before each replicationvoidsetResetStartStreamOption(boolean b)If set to true then the streams will be reset to the start of the stream prior to running the experiments.voidstop()This sets a flag to indicate to the process that is should stop after the next step is completed.voidstop(java.lang.String msg)This sets a flag to indicate to the process that is should stop after the next step is completed.booleanstoppedByCondition()Checks if the simulation has ended because it was stoppedjava.lang.StringtoString()voidturnOffDefaultEventTraceReport()Turns off a default tracing report for the Executive to trace event execution to a filevoidturnOffLogReport()Turns of the default logging reportvoidturnOnDefaultEventTraceReport()Turns on a default tracing report for the Executive to trace event execution to a filevoidturnOnDefaultEventTraceReport(java.lang.String name)Turns on a default tracing report for the Executive to trace event execution to a filevoidturnOnLogReport()voidturnOnLogReport(java.lang.String reportFileName)voidturnOnLogReport(java.nio.file.Path pathToFile)Turns on a default logging report with the provided nameStatisticalBatchingElementturnOnStatisticalBatching()A StatisticalBatchingElement is used to control statistical batching for single replication simulations.voidturnOnTimer(long milliseconds)Turns on a default timer and task to report on simulation progressvoidwriteHalfWidthSummaryReport(java.io.PrintWriter out)voidwriteHalfWidthSummaryReport(java.io.PrintWriter out, double confLevel)voidwriteHalfWidthSummaryReport(java.io.PrintWriter out, java.lang.String title, double confLevel)
-
-
-
Field Detail
-
LOGGER
public static final org.slf4j.Logger LOGGER
for logging
-
myModel
protected final Model myModel
The model to simulate
-
-
Constructor Detail
-
Simulation
public Simulation()
Creates a simulation within a default name using the default executive
-
Simulation
public Simulation(java.lang.String simName)
Creates a simulation to run a model using the default scheduling executive.- Parameters:
simName- the name of the simulation
-
Simulation
public Simulation(java.lang.String simName, java.nio.file.Path pathToOutputDirectory)Creates a simulation to run a model using the default scheduling executive.- Parameters:
simName- the name of the simulationpathToOutputDirectory- the path to the output directory for the simulation files
-
Simulation
public Simulation(java.lang.String simName, java.nio.file.Path pathToOutputDirectory, Executive executive)Creates a simulation to run a model using the supplied scheduling executive.- Parameters:
simName- the name of the simulationpathToOutputDirectory- the path to the output directory for the simulation filesexecutive- the executive, if null the default executive is used
-
-
Method Detail
-
getOutputDirectory
public final OutputDirectory getOutputDirectory()
- Returns:
- the defined OutputDirectory for the simulation
-
getOutputDirectoryPath
public final java.nio.file.Path getOutputDirectoryPath()
- Returns:
- the path to the simulation's output directory
-
out
public final LogPrintWriter out()
- Returns:
- the pre-defined default text output file for the simulation
-
getName
public final java.lang.String getName()
- Specified by:
getNamein interfaceGetNameIfc- Returns:
- a string representing the name of the object
-
getId
public final long getId()
-
getExperiment
public final ExperimentGetIfc getExperiment()
The Experiment associated with the simulation- Returns:
- the experiment
-
getModel
public final Model getModel()
The Model associated with the simulation- Returns:
- the model
-
getExecutive
public final Executive getExecutive()
The Executive associated with the simulation- Returns:
- the Executive
-
turnOnStatisticalBatching
public final StatisticalBatchingElement turnOnStatisticalBatching()
A StatisticalBatchingElement is used to control statistical batching for single replication simulations. This method creates and attaches a StatisticalBatchingElement to the model. For convenience, it also returns the created element- Returns:
- the StatisticalBatchingElement
-
getStatisticalBatchingElement
public final java.util.Optional<StatisticalBatchingElement> getStatisticalBatchingElement()
- Returns:
- an optional of the StatisticalBatchingElement because it may or may not be attached
-
deleteObservers
public final void deleteObservers()
Description copied from interface:ObservableIfcDeletes all the observers from the observable- Specified by:
deleteObserversin interfaceObservableIfc
-
deleteObserver
public final void deleteObserver(ObserverIfc observer)
Description copied from interface:ObservableIfcAllows the deletion (removing) of an observer from the observable- Specified by:
deleteObserverin interfaceObservableIfc- Parameters:
observer- the observer to delete
-
countObservers
public final int countObservers()
Description copied from interface:ObservableIfcReturns how many observers are currently observing the observable- Specified by:
countObserversin interfaceObservableIfc- Returns:
- number of observers
-
addObserver
public final void addObserver(ObserverIfc observer)
Allows an observer to be added to the simulation. The observer observes an IterativeProcess that manages the execution of the replications. Each step in the IterativeProcess represents an entire replication.- Specified by:
addObserverin interfaceObservableIfc- Parameters:
observer- the observer
-
contains
public boolean contains(ObserverIfc observer)
Description copied from interface:ObservableIfcReturns true if the observer is already attached- Specified by:
containsin interfaceObservableIfc- Parameters:
observer- the observer to check- Returns:
- true if attached
-
hasNextReplication
public final boolean hasNextReplication()
Returns true if additional replications need to be run- Returns:
- true if additional replications need to be run
-
initialize
public final void initialize()
Initializes the simulation in preparation for running- Specified by:
initializein interfaceIterativeProcessIfc
-
runNext
public final void runNext()
Runs the next replication if there is one- Specified by:
runNextin interfaceIterativeProcessIfc
-
run
public final void run(int numReps, double runLength)A convenience method for running a simulation- Parameters:
numReps- the number of replicationsrunLength- the length of the simulation replication
-
run
public final void run(java.lang.String expName, int numReps, double runLength)A convenience method for running a simulation- Parameters:
expName- the name of the experimentnumReps- the number of replicationsrunLength- the length of the simulation replication
-
run
public final void run(java.lang.String expName, int numReps, double runLength, double warmUp)A convenience method for running a simulation- Parameters:
expName- the name of the experimentnumReps- the number of replicationsrunLength- the length of the simulation replicationwarmUp- the length of the warm up period
-
run
public final void run()
Runs all remaining replications based on the current settings- Specified by:
runin interfaceIterativeProcessIfc
-
end
public final void end(java.lang.String msg)
Causes the simulation to end after the current replication is completed- Specified by:
endin interfaceIterativeProcessIfc- Parameters:
msg- A message to indicate why the simulation was stopped
-
end
public final void end()
Causes the simulation to end after the current replication is completed- Specified by:
endin interfaceIterativeProcessIfc
-
isUnfinished
public final boolean isUnfinished()
Checks if the replications were finished- Specified by:
isUnfinishedin interfaceIterativeProcessIfc- Returns:
- true if unfinished
-
executionTimeExceeded
public final boolean executionTimeExceeded()
Checks if the simulation stopped because of real clock time- Specified by:
executionTimeExceededin interfaceIterativeProcessIfc- Returns:
- true if exceeded
-
isStepCompleted
public final boolean isStepCompleted()
Part of the IterativeProcessIfc. Checks if a step in the process is completed. A step is a replication Checks if the state of the simulation is that it just completed a replication- Specified by:
isStepCompletedin interfaceIterativeProcessIfc- Returns:
- true if completed
-
isRunning
public final boolean isRunning()
Checks if the simulation is running. Running means that it is executing replications- Specified by:
isRunningin interfaceIterativeProcessIfc- Returns:
- true means it is running
-
isInitialized
public final boolean isInitialized()
Checks if the simulation has been initialized. If it is initialized, then it is ready to run replications- Specified by:
isInitializedin interfaceIterativeProcessIfc- Returns:
- true if initialized
-
isEnded
public final boolean isEnded()
Checks to see if the simulation is in the ended state If it is ended, it may be for a number of reasons- Specified by:
isEndedin interfaceIterativeProcessIfc- Returns:
- true if end
-
isCreated
public final boolean isCreated()
Description copied from interface:IterativeProcessIfcChecks if the iterative process is in the created state. If the iterative process is in the created state this method will return true- Specified by:
isCreatedin interfaceIterativeProcessIfc- Returns:
- true if in the created state
-
stoppedByCondition
public final boolean stoppedByCondition()
Checks if the simulation has ended because it was stopped- Specified by:
stoppedByConditionin interfaceIterativeProcessIfc- Returns:
- true if stopped by condition
-
isDone
public final boolean isDone()
Checks if the simulation is done processing replications- Specified by:
isDonein interfaceIterativeProcessIfc- Returns:
- true if done
-
allStepsCompleted
public final boolean allStepsCompleted()
Checks if the simulation completed all of its replications- Specified by:
allStepsCompletedin interfaceIterativeProcessIfc- Returns:
- true if all
-
setMaximumExecutionTime
public final void setMaximumExecutionTime(long milliseconds)
Sets a real clock time for how long the entire simulation can last- Specified by:
setMaximumExecutionTimein interfaceIterativeProcessIfc- Parameters:
milliseconds- the max allowed
-
getMaximumAllowedExecutionTime
public final long getMaximumAllowedExecutionTime()
Returns the real clock time in milliseconds for how long the simulation is allowed to run- Specified by:
getMaximumAllowedExecutionTimein interfaceIterativeProcessIfc- Returns:
- the max allowed
-
getEndExecutionTime
public final long getEndExecutionTime()
The absolute time in milliseconds that the simulation ended- Specified by:
getEndExecutionTimein interfaceIterativeProcessIfc- Returns:
- the end time (in real clock time)
-
getElapsedExecutionTime
public final long getElapsedExecutionTime()
The time in milliseconds between when the simulation was started and the simulation ended- Specified by:
getElapsedExecutionTimein interfaceIterativeProcessIfc- Returns:
- the elapsed time (in real clock time)
-
getBeginExecutionTime
public final long getBeginExecutionTime()
The absolute time in milliseconds that the simulation was started- Specified by:
getBeginExecutionTimein interfaceIterativeProcessIfc- Returns:
- the begin time (in real clock time)
-
getStoppingMessage
public final java.lang.String getStoppingMessage()
The message supplied with stop()- Specified by:
getStoppingMessagein interfaceIterativeProcessIfc- Returns:
- the stopping message
-
turnOnTimer
public final void turnOnTimer(long milliseconds)
Turns on a default timer and task to report on simulation progress- Specified by:
turnOnTimerin interfaceIterativeProcessIfc- Parameters:
milliseconds- time for timer task
-
turnOnLogReport
public final void turnOnLogReport()
-
turnOnLogReport
public final void turnOnLogReport(java.lang.String reportFileName)
- Parameters:
reportFileName- the name of the report
-
turnOnLogReport
public final void turnOnLogReport(java.nio.file.Path pathToFile)
Turns on a default logging report with the provided name- Specified by:
turnOnLogReportin interfaceIterativeProcessIfc- Parameters:
pathToFile- the path to the file
-
turnOffLogReport
public final void turnOffLogReport()
Turns of the default logging report- Specified by:
turnOffLogReportin interfaceIterativeProcessIfc
-
getNumberStepsCompleted
public final long getNumberStepsCompleted()
For the IterativeProcessIfc. Returns the number of steps (replications) completed- Specified by:
getNumberStepsCompletedin interfaceIterativeProcessIfc- Returns:
- number of steps completed
-
getLogReport
public final IPLogReport getLogReport()
Gets the IPLogReport that was attached to the simulation- Specified by:
getLogReportin interfaceIterativeProcessIfc- Returns:
- the IPLogReport
-
getCurrentReplicationNumber
public final int getCurrentReplicationNumber()
Returns the current number of replications completed- Specified by:
getCurrentReplicationNumberin interfaceExperimentGetIfc- Returns:
- the number as a double
-
hasMoreReplications
public final boolean hasMoreReplications()
Description copied from interface:ExperimentGetIfcChecks if the current number of replications that have been executed is less than the number of replications specified.- Specified by:
hasMoreReplicationsin interfaceExperimentGetIfc- Returns:
- true if more
-
getNumberOfReplications
public final int getNumberOfReplications()
Returns the number of replications for the experiment- Specified by:
getNumberOfReplicationsin interfaceExperimentGetIfc- Returns:
- the number of replications
-
getNumberOfStreamAdvancesPriorToRunning
public final int getNumberOfStreamAdvancesPriorToRunning()
Description copied from interface:ExperimentGetIfcReturns the number of times that the streams should be advanced prior to running the experiment- Specified by:
getNumberOfStreamAdvancesPriorToRunningin interfaceExperimentGetIfc- Returns:
- number of streams to advance
-
setResetStartStreamOption
public final void setResetStartStreamOption(boolean b)
If set to true then the streams will be reset to the start of the stream prior to running the experiments. True facilitates the use of common random numbers.- Parameters:
b- true means option is on
-
setAdvanceNextSubStreamOption
public final void setAdvanceNextSubStreamOption(boolean b)
Sets the option to have the streams advance to the beginning of the next substream after each replication- Parameters:
b- true means option is on
-
setReplicationInitializationOption
public final void setReplicationInitializationOption(boolean repInitOption)
Sets whether or not the replication should be initialized before each replication- Parameters:
repInitOption- true for initialize
-
setNumberOfReplications
public final void setNumberOfReplications(int numReps, boolean antitheticOption)Sets the number of replications to be executed and whether or not the antithetic option is on. If the antithetic option is on then the number of replications should be divisible by 2 so that antithetic pairs can be formed.- Parameters:
numReps- number of replicationsantitheticOption- true means option is on
-
setNumberOfReplications
public final void setNumberOfReplications(int numReps)
Sets the number of replications to be executed. The antithetic option is off- Parameters:
numReps- number of replications
-
setMaximumExecutionTimePerReplication
public final void setMaximumExecutionTimePerReplication(long milliseconds)
Sets in real clock time (milliseconds) the amount of time available for each replication within the simulation. If the replication lasts longer than the supplied time it will be stopped- Parameters:
milliseconds- clock time for a replication
-
setLengthOfWarmUp
public final void setLengthOfWarmUp(double lengthOfWarmUp)
Allows the length of the warm up period for each replication to be set- Parameters:
lengthOfWarmUp- in simulation time
-
setLengthOfReplication
public final void setLengthOfReplication(double lengthOfReplication)
Sets the length of the replications in simulation time.- Parameters:
lengthOfReplication- the length of the replication
-
getExperimentName
public final java.lang.String getExperimentName()
Description copied from interface:ExperimentGetIfcGets the name.- Specified by:
getExperimentNamein interfaceExperimentGetIfc- Returns:
- The name of object.
-
getExperimentId
public final long getExperimentId()
Description copied from interface:ExperimentGetIfcReturns the id for this object- Specified by:
getExperimentIdin interfaceExperimentGetIfc- Returns:
- the id
-
getResetStartStreamOption
public final boolean getResetStartStreamOption()
Returns whether or not the start stream will be reset prior to executing the simulation- Specified by:
getResetStartStreamOptionin interfaceExperimentGetIfc- Returns:
- true if option is on
-
getAdvanceNextSubStreamOption
public final boolean getAdvanceNextSubStreamOption()
Returns how many times the random number streams will be advanced before the simulation starts.- Specified by:
getAdvanceNextSubStreamOptionin interfaceExperimentGetIfc- Returns:
- true if option is on
-
getReplicationInitializationOption
public final boolean getReplicationInitializationOption()
Returns whether or not replications will be initialized prior to running each replication- Specified by:
getReplicationInitializationOptionin interfaceExperimentGetIfc- Returns:
- true if replications will be initialized
-
getMaximumAllowedExecutionTimePerReplication
public final long getMaximumAllowedExecutionTimePerReplication()
Gets in real clock time (milliseconds) the amount of time available for each replication within the simulation. If the replication lasts longer than the supplied time it will be stopped- Specified by:
getMaximumAllowedExecutionTimePerReplicationin interfaceExperimentGetIfc- Returns:
- the clock time allowed
-
getLengthOfWarmUp
public final double getLengthOfWarmUp()
Provides the length of the warm up period for each replication- Specified by:
getLengthOfWarmUpin interfaceExperimentGetIfc- Returns:
- the length of the warm up period
-
getLengthOfReplication
public final double getLengthOfReplication()
Provides the length of each replication- Specified by:
getLengthOfReplicationin interfaceExperimentGetIfc- Returns:
- the length of the replication
-
getAntitheticOption
public final boolean getAntitheticOption()
Indicates whether or not the antithetic streams have been turn on or off- Specified by:
getAntitheticOptionin interfaceExperimentGetIfc- Returns:
- true means option is on
-
setGarbageCollectAfterReplicationFlag
public final void setGarbageCollectAfterReplicationFlag(boolean flag)
Determines whether or not System.gc() is called after each replication- Parameters:
flag- true means yes
-
getGarbageCollectAfterReplicationFlag
public final boolean getGarbageCollectAfterReplicationFlag()
Returns whether or not System.gc() is called after each replication- Specified by:
getGarbageCollectAfterReplicationFlagin interfaceExperimentGetIfc- Returns:
- true means yes
-
setAdvanceStreamNumber
public final void setAdvanceStreamNumber(int n)
Sets the number of streams to advance prior to running an experiment- Parameters:
n- the number to advance
-
getRepLengthWarningMessageOption
public final boolean getRepLengthWarningMessageOption()
- Returns:
- true if the flag permits the message to be printed
-
setRepLengthWarningMessageOption
public final void setRepLengthWarningMessageOption(boolean flag)
False turns off the message- Parameters:
flag- false turns of the message
-
setExperimentName
public final void setExperimentName(java.lang.String name)
Sets the name of the underlying experiment- Parameters:
name- the name to set
-
setExperiment
protected final void setExperiment(Experiment e)
Set the simulation experiment to the same attribute values as the supplied experiment- Parameters:
e- the experiment
-
turnOnDefaultEventTraceReport
public final void turnOnDefaultEventTraceReport(java.lang.String name)
Turns on a default tracing report for the Executive to trace event execution to a file- Parameters:
name- the name of the file
-
turnOnDefaultEventTraceReport
public final void turnOnDefaultEventTraceReport()
Turns on a default tracing report for the Executive to trace event execution to a file
-
turnOffDefaultEventTraceReport
public final void turnOffDefaultEventTraceReport()
Turns off a default tracing report for the Executive to trace event execution to a file
-
getDefaultExecutiveTraceReport
public final java.util.Optional<ExecutiveTraceReport> getDefaultExecutiveTraceReport()
Gets a reference to the default event tracing report. May be null if not turned on.- Returns:
- the ExecutiveTraceReport
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getHalfWidthSummaryReport
public java.lang.StringBuilder getHalfWidthSummaryReport()
- Returns:
- a StringBuilder with the Half-Width Summary Report and 95 percent confidence
-
getHalfWidthSummaryReport
public java.lang.StringBuilder getHalfWidthSummaryReport(double confLevel)
- Parameters:
confLevel- the confidence level of the report- Returns:
- a StringBuilder with the Half-Width Summary Report
-
getHalfWidthSummaryReport
public java.lang.StringBuilder getHalfWidthSummaryReport(java.lang.String title, double confLevel)- Parameters:
title- the titleconfLevel- the confidence level- Returns:
- a StringBuilder representation of the half-width summary report
-
printHalfWidthSummaryReport
public void printHalfWidthSummaryReport()
Prints the default half-width summary report to the console
-
printHalfWidthSummaryReport
public void printHalfWidthSummaryReport(double confLevel)
- Parameters:
confLevel- the confidence level of the report
-
printHalfWidthSummaryReport
public void printHalfWidthSummaryReport(java.lang.String title, double confLevel)- Parameters:
title- the title of the reportconfLevel- the confidence level of the report
-
writeHalfWidthSummaryReport
public void writeHalfWidthSummaryReport(java.io.PrintWriter out)
- Parameters:
out- the place to write to
-
writeHalfWidthSummaryReport
public void writeHalfWidthSummaryReport(java.io.PrintWriter out, double confLevel)- Parameters:
out- the place to write toconfLevel- the confidence level of the report
-
writeHalfWidthSummaryReport
public void writeHalfWidthSummaryReport(java.io.PrintWriter out, java.lang.String title, double confLevel)- Parameters:
out- the place to write totitle- the title of the reportconfLevel- the confidence level of the report
-
makeSimulationReporter
public SimulationReporter makeSimulationReporter()
Constructs a SimulationReporter instance that uses this Simulation instance- Returns:
- the SimulationReporter
-
beforeExperiment
protected void beforeExperiment()
This method is automatically called at the start of the experiment Sub-classes can inject behavior within here
-
afterExperiment
protected void afterExperiment()
This method is automatically called at the end of the experiment Sub-classes can inject behavior within here
-
beforeReplication
protected void beforeReplication()
This method is automatically called before each replication Sub-classes can inject behavior within here
-
afterReplication
protected void afterReplication()
This method is automatically called after each replication Sub-classes can inject behavior within here
-
isExecutionTimeExceeded
public final boolean isExecutionTimeExceeded()
Description copied from interface:IterativeProcessIfcReturns if the elapsed execution time exceeds the maximum time allowed. Only true if the maximum was set and elapsed time is greater than or equal to getMaximumAllowedExecutionTime()- Specified by:
isExecutionTimeExceededin interfaceIterativeProcessIfc- Returns:
- true if the execution time exceeds getMaximumAllowedExecutionTime()
-
getStoppingFlag
public final boolean getStoppingFlag()
Description copied from interface:IterativeProcessIfcReturns the stopping flag- Specified by:
getStoppingFlagin interfaceIterativeProcessIfc- Returns:
- true if the process has been told to stop via stop()
-
stop
public final void stop()
Description copied from interface:IterativeProcessIfcThis sets a flag to indicate to the process that is should stop after the next step is completed. This is different than end(). Calling end() immediately places the process in the End state. The process needs to be in a valid state before end() can be used. Calling stop tells the process to eventually get into the end state. stop() can be used to arbitrarily stop the process based on some user defined condition.- Specified by:
stopin interfaceIterativeProcessIfc
-
stop
public final void stop(java.lang.String msg)
Description copied from interface:IterativeProcessIfcThis sets a flag to indicate to the process that is should stop after the next step is completed. This is different than end(). Calling end() immediately places the process in the End state. The process needs to be in a valid state before end() can be used. Calling stop tells the process to eventually get into the end state. stop() can be used to arbitrarily stop the process based on some user defined condition.- Specified by:
stopin interfaceIterativeProcessIfc- Parameters:
msg- A string to represent the reason for the stopping
-
isRunningStep
public final boolean isRunningStep()
Description copied from interface:IterativeProcessIfcIndicates that the iterative process is currently running an individual step- Specified by:
isRunningStepin interfaceIterativeProcessIfc- Returns:
- true if the step is in progress
-
noStepsExecuted
public final boolean noStepsExecuted()
Description copied from interface:IterativeProcessIfcIndicates that the iterative process ended because of no steps- Specified by:
noStepsExecutedin interfaceIterativeProcessIfc- Returns:
- True if no steps are executed
-
-