JGAP

org.jgap.audit
Class ChainedMonitors

java.lang.Object
  extended by org.jgap.audit.ChainedMonitors
All Implemented Interfaces:
java.io.Serializable, IEvolutionMonitor

public class ChainedMonitors
extends java.lang.Object
implements IEvolutionMonitor

A meta monitor that chains together given monitors and executes them subsequently.

Since:
3.4.4
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.jgap.audit.IEvolutionMonitor
MONITOR_EVENT_AFTER_BULK_EVAL, MONITOR_EVENT_AFTER_OPERATE, MONITOR_EVENT_AFTER_SELECT, MONITOR_EVENT_AFTER_UPDATE_CHROMOSOMES1, MONITOR_EVENT_AFTER_UPDATE_CHROMOSOMES2, MONITOR_EVENT_BEFORE_ADD_CHROMOSOME, MONITOR_EVENT_BEFORE_BULK_EVAL, MONITOR_EVENT_BEFORE_OPERATE, MONITOR_EVENT_BEFORE_SELECT, MONITOR_EVENT_BEFORE_UPDATE_CHROMOSOMES1, MONITOR_EVENT_BEFORE_UPDATE_CHROMOSOMES2, MONITOR_EVENT_READD_FITTEST, MONITOR_EVENT_REMOVE_CHROMOSOME
 
Constructor Summary
ChainedMonitors(java.util.List<IEvolutionMonitor> a_monitors, int a_positiveMonitorsRequired)
           
 
Method Summary
 void event(java.lang.String a_monitorEvent, int a_evolutionNo, java.lang.Object[] a_information)
          Called whenever it's worth monitoring.
 java.util.List<IEvolutionMonitor> getMonitors()
           
 PopulationHistoryIndexed getPopulations()
           
 boolean nextCycle(Population a_pop, java.util.List<java.lang.String> a_messages)
          Called after another evolution cycle has been executed.
 void start(Configuration a_config)
          Called just before the evolution starts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainedMonitors

public ChainedMonitors(java.util.List<IEvolutionMonitor> a_monitors,
                       int a_positiveMonitorsRequired)
Parameters:
a_monitors - sequence of monitors to use
a_positiveMonitorsRequired - number of monitors that must return true in nextCycle in order to let the evolution continue. If this parameter equals one, it means we have an or-operation, if it equals the number of monitors, we have an and-operation.
Since:
3.4.4
Method Detail

nextCycle

public boolean nextCycle(Population a_pop,
                         java.util.List<java.lang.String> a_messages)
Called after another evolution cycle has been executed.

Specified by:
nextCycle in interface IEvolutionMonitor
Parameters:
a_pop - the currently evolved population
a_messages - the monitor can append messages here to indicate why it asks evolution to stop
Returns:
true: continue with the evolution; false: stop evolution
Since:
3.4.4

start

public void start(Configuration a_config)
Called just before the evolution starts.

Specified by:
start in interface IEvolutionMonitor
Parameters:
a_config - the configuration used

event

public void event(java.lang.String a_monitorEvent,
                  int a_evolutionNo,
                  java.lang.Object[] a_information)
Called whenever it's worth monitoring.

Specified by:
event in interface IEvolutionMonitor
Parameters:
a_monitorEvent - see constants at top of class IEvolutionMonitor
a_evolutionNo - the index of the evolution round (1, 2, ...)
a_information - event-specific information
Since:
3.5

getPopulations

public PopulationHistoryIndexed getPopulations()
Specified by:
getPopulations in interface IEvolutionMonitor
Returns:
null, use getMonitors() and then call each monitor's method
Since:
3.5

getMonitors

public java.util.List<IEvolutionMonitor> getMonitors()
Returns:
List of monitors registered
Since:
3.5

JGAP