24package umontreal.ssj.simexp;
26import umontreal.ssj.simevents.Simulator;
50 private int targetReps;
62 this(minReps, Integer.MAX_VALUE);
76 public RepSim(
int minReps,
int maxReps) {
89 this(sim, minReps, Integer.MAX_VALUE);
105 throw new IllegalArgumentException(
"minReps <= 0");
106 if (minReps > maxReps)
107 throw new IllegalArgumentException(
"minReps > maxReps");
108 this.minReps = minReps;
109 this.maxReps = maxReps;
110 targetReps = minReps;
135 throw new IllegalArgumentException(
"minReps <= 0");
136 this.minReps = minReps;
137 if (maxReps < minReps)
161 if (maxReps < minReps)
162 throw new IllegalArgumentException(
"maxReps < minReps");
163 this.maxReps = maxReps;
190 if (targetReps < minReps)
191 throw new IllegalArgumentException(
"Target number of replications too small");
192 if (targetReps > maxReps)
193 throw new IllegalArgumentException(
"Target number of replications too large");
194 this.targetReps = targetReps;
278 throw new IllegalStateException(
"Already simulating");
280 if (targetReps < minReps)
282 targetReps = minReps;
296 if (numNewReplications < 0)
297 throw new IllegalArgumentException(
"numReplications < 0");
298 if (numNewReplications == 0)
300 targetReps = doneReps + numNewReplications;
301 if (targetReps > maxReps)
302 targetReps = maxReps;
320 while (doneReps < targetReps) {
321 for (
int i = 0; i < targetReps; i++)
330 public String toString() {
331 StringBuffer sb =
new StringBuffer(getClass().getName());
333 sb.append(
"minimal number of replications: ").append(minReps);
334 if (maxReps < Integer.MAX_VALUE)
335 sb.append(
", maximal number of replications: ").append(maxReps);
336 sb.append(
", target number of replications: ").append(targetReps);
338 sb.append(
", simulation in progress");
340 sb.append(
", simulation stopped");
341 sb.append(
", number of completed replications: ").append(doneReps);
343 return sb.toString();
Represents the executive of a discrete-event simulator.
void start()
Starts the simulation executive.
void init()
Reinitializes the simulation executive by clearing up the event list, and resetting the simulation cl...
static Simulator getDefaultSimulator()
Returns the default simulator instance used by the deprecated class.
int getMaxReplications()
Returns the maximal number of replications to be simulated before an error check.
int getCompletedReplications()
Returns the total number of completed replications for the current experiment.
void setTargetReplications(int targetReps)
Sets the target number of simulated replications before an error check to targetReps.
RepSim(Simulator sim, int minReps, int maxReps)
Equivalent to the second constructor, with the given simulator sim.
void setMaxReplications(int maxReps)
Sets the maximal number of replications required before an error check to maxReps.
RepSim(Simulator sim, int minReps)
Equivalent to the first constructor, with the given simulator sim.
int getMinReplications()
Returns the minimal number of replications to be simulated before an error check.
RepSim(int minReps)
Constructs a new replications-based simulator with a minimal number of runs, minReps,...
void simulate()
Simulates several independent simulation replications of a system.
abstract void addReplicationObs(int r)
Adds statistical observations for the replication r.
abstract void initReplicationProbes()
Initializes any statistical collector used to collect values for replications.
abstract void initReplication(int r)
Initializes the simulation model for a new replication r.
int getRequiredNewReplications()
Returns the approximate number of additional replications to meet an experiment-specific stopping cri...
RepSim(int minReps, int maxReps)
Constructs a new replications-based simulator with a minimal number of runs minReps,...
void setMinReplications(int minReps)
Sets the minimal number of replications required before an error check to minReps.
void replicationDone()
Increments by one the number of completed replications.
void init()
Initializes this simulator for a new experiment.
int getTargetReplications()
Returns the actual target number of replications to be simulated before an error check.
void adjustTargetReplications(int numNewReplications)
Adjusts the target number of replications to simulate numNewReplications additional replications.
void performReplication(int r)
Contains the necessary logic to perform the rth replication of the simulation.
boolean simulating
Determines if the simulation is in progress.
SimExp()
Constructs a new object for performing experiments using the default simulator returned by Simulator....
final Simulator simulator()
Returns the simulator linked to this experiment object.