|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread net.sourceforge.cilib.simulator.Simulation
public class Simulation
This class represents a single simulation experiment. The experiment is repeated based on the number of samples that the measurement suite requires. In this implementation each experiment is run in its own thread. Thus, each experiment is run in parallel for a given simulation.
The simulation executes a given algorithm on the given problem. Factories are utilised so that the simulation can create as many alogirthms and problems as it needs to run many experiments.
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 performace.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
Simulation(AlgorithmFactory algorithmFactory,
ProblemFactory problemFactory,
MeasurementSuite measurementSuite)
Creates a new instance of Simulation given an algorithm factory, a problem factory and a measurement suite. |
Method Summary | |
---|---|
void |
addProgressListener(ProgressListener listener)
Adds a listener for progress events. |
void |
algorithmFinished(AlgorithmEvent e)
This event is fired when the algorithm has completed normally. |
void |
algorithmStarted(AlgorithmEvent e)
This event is fired just prior to the execution of the main loop of the algorithm. |
void |
algorithmTerminated(AlgorithmEvent e)
This event is fired when the algorithm is terminated abnormally. |
Simulation |
getClone()
Create a cloned copy of the current object and return it. |
void |
initialise()
|
void |
iterationCompleted(AlgorithmEvent e)
This event is fired after each iteration of the mail loop of the algorithm. |
void |
removeProgressListener(ProgressListener listener)
Removes a listener for progress events. |
void |
run()
Executes all the experiments for this simulation. |
void |
terminate()
Terminates all the experiments. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Simulation(AlgorithmFactory algorithmFactory, ProblemFactory problemFactory, MeasurementSuite measurementSuite)
net.sourceforge.cilib.XMLObjectFactory
algorithmFactory
- The algorithm factory.problemFactory
- The problem factory.measurementSuite
- The measurement suite.Method Detail |
---|
public Simulation getClone()
AlgorithmListener
getClone
in interface AlgorithmListener
getClone
in interface Cloneable
Object.clone()
public void initialise()
public void run()
run
in interface Runnable
run
in class Thread
public void terminate()
public void addProgressListener(ProgressListener listener)
ProgressEvent
ProgressListener
The
- event listenerpublic void removeProgressListener(ProgressListener listener)
The
- event listenerpublic void algorithmStarted(AlgorithmEvent e)
AlgorithmListener
algorithmStarted
in interface AlgorithmListener
e
- an event containing a reference to the source algorithm.public void algorithmFinished(AlgorithmEvent e)
AlgorithmListener
algorithmFinished
in interface AlgorithmListener
e
- an event containing a reference to the source algorithm.public void algorithmTerminated(AlgorithmEvent e)
AlgorithmListener
algorithmTerminated
in interface AlgorithmListener
e
- an event containing a reference to the source algorithm.public void iterationCompleted(AlgorithmEvent e)
AlgorithmListener
iterationCompleted
in interface AlgorithmListener
e
- an event containing a reference to the source algorithm.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |