Watchmaker Framework for Evolutionary Computation API
(Version 0.7.1)

Interface EvolutionObserver<T>

Type Parameters:
T - The type of entity that exists in the evolving population that is being observed. This type can be bound to a super-type of the actual population type so as to allow a non-specific observer that can be re-used for different population types.
All Known Subinterfaces:
All Known Implementing Classes:
EvolutionMonitor, StatusBar

public interface EvolutionObserver<T>

Call-back interface so that programs can monitor the state of a long-running evolutionary algorithm.

Depending on the parameters of the evolutionary program, an observer may be invoked dozens or hundreds of times a second, especially when the population size is small as this leads to shorter generations. The processing performed by an evolution observer should be reasonably short-lived so as to avoid slowing down the evolution.

Using an EvolutionObserver to update a Swing GUI: Evolution updates are dispatched on the request thread. To adhere to Swing threading rules you must use SwingUtilities.invokeLater(Runnable) or SwingUtilities.invokeAndWait(Runnable) to perform any updates to Swing components.

Be aware that if there are too many Swing updates queued for asynchronous execution with SwingUtilities.invokeLater(Runnable), due to a high number of generations per second, then the GUI will become sluggish and unresponsive. This situation can be mitigated by minimising the amount of work done by the evolution observer and/or by not updating the GUI every time the observer is notified.

The unresponsive GUI problem does not occur when using SwingUtilities.invokeAndWait(Runnable) because updates are executed synchronously. The downside is that evolution threads are stalled/idle until Swing has finished performing the updates. This won't make much difference on a single core machine but will impact throughput on multi-core machines.

Daniel Dyer

Method Summary
 void populationUpdate(PopulationData<? extends T> data)
          Invoked when the state of the population has changed (typically at the end of a generation).

Method Detail


void populationUpdate(PopulationData<? extends T> data)
Invoked when the state of the population has changed (typically at the end of a generation).

data - Statistics about the state of the current generation.

Watchmaker Framework for Evolutionary Computation API
(Version 0.7.1)