T
- extends Chromosomepublic interface AlgorithmEventListener<T extends Chromosome>
AlgorithmEventListener
provides the interface for capturing events at algorithm level.
This iterface should be implemented by all classes interested in being notified by
algorithm events, that are:
An AlgorithmEventListener
is registered to the algorithm by the method GeneticAlgorithm.addAlgorithmEventListener(AlgorithmEventListener)
.
The listener is removed by invoking the method GeneticAlgorithm.removeAlgorithmEventListener(AlgorithmEventListener)
.
An
Another way to get notified of algorithms events is to override methods AlgorithmEventListener
can be registered to multiple different algorithms, thus being notified by all of them.
GeneticAlgorithm.onStart(long)
, GeneticAlgorithm.onInit(long)
and GeneticAlgorithm.onStop(long)
when subclassing the GeneticAlgorithm
class.
GeneticAlgorithm
Modifier and Type | Method and Description |
---|---|
void |
onAlgorithmInit(GeneticAlgorithm<T> ga,
long time)
Invoked when the genetic algorithm is initialized
|
void |
onAlgorithmStart(GeneticAlgorithm<T> ga,
long time)
Invoked when the genetic algorithm starts
|
void |
onAlgorithmStop(GeneticAlgorithm<T> ga,
long time)
Invoked when the genetic algorithm ends
|
void onAlgorithmStart(GeneticAlgorithm<T> ga, long time)
ga
- the genetic algorithm that generated this event.time
- the event time expressed in millisecondsvoid onAlgorithmStop(GeneticAlgorithm<T> ga, long time)
ga
- the genetic algorithm that generated this event.time
- the event time expressed in millisecondsvoid onAlgorithmInit(GeneticAlgorithm<T> ga, long time)
ga
- the genetic algorithm that generated this event.time
- the event time expressed in milliseconds