public class Simulator
extends java.lang.Object
This class represents an instance of a "simulator" that may or may not contain multiple individual simulations.
Each simulation experiment is repeated based on the number of samples that the measurement suite requires (although this is subject to change in a future version of the library). In this implementation each experiment is execute in its own thread. Thus, each experiment is execute in parallel for a given simulation.
The primary purpose of running simulations is to measure the performance of the given algorithm on a given problem. For that reason, a simulation accepts a measurement suite which it uses to record the performance.
| Constructor and Description |
|---|
Simulator(XMLObjectFactory algorithmFactory,
XMLObjectFactory problemFactory,
XMLObjectFactory measurementFactory,
MeasurementCombiner combiner,
int samples,
net.sourceforge.cilib.math.random.generator.seeder.SeedSelectionStrategy seeder)
Creates a new instance of Simulator given an algorithm factory, a problem factory and a
measurement suite.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addProgressListener(net.sourceforge.cilib.algorithm.ProgressListener listener)
Adds a listener for progress events.
|
Simulation |
createSimulation() |
void |
execute()
Executes all the experiments for this simulation.
|
int |
getSamples() |
void |
init()
Perform the initialisation of the
Simulator by creating the required
Simulation instances and executing the threads. |
void |
removeProgressListener(net.sourceforge.cilib.algorithm.ProgressListener listener)
Removes a listener for progress events.
|
void |
terminate()
Terminates all the experiments.
|
public Simulator(XMLObjectFactory algorithmFactory, XMLObjectFactory problemFactory, XMLObjectFactory measurementFactory, MeasurementCombiner combiner, int samples, net.sourceforge.cilib.math.random.generator.seeder.SeedSelectionStrategy seeder)
algorithmFactory - The algorithm factory.problemFactory - The problem factory.measurementFactory - The measurement suite.net.sourceforge.cilib.XMLObjectFactorypublic void init()
Simulator by creating the required
Simulation instances and executing the threads.public Simulation createSimulation()
public void execute()
public void terminate()
public void addProgressListener(net.sourceforge.cilib.algorithm.ProgressListener listener)
ProgressEvent ProgressListenerlistener - The event listenerpublic void removeProgressListener(net.sourceforge.cilib.algorithm.ProgressListener listener)
listener - The event listenerpublic int getSamples()