com.epochx.life
Class LifeCycleManager<TYPE>

java.lang.Object
  extended by com.epochx.life.LifeCycleManager<TYPE>

public class LifeCycleManager<TYPE>
extends java.lang.Object

The life cycle manager's job is to keep track of all those objects that want to be informed about life cycle events and to let them know when events happen. TODO This is from LifeCycleListener... Implementations of LifeCycleListener can be used to listen for events throughout the life of a GE run. The provided methods will be called at the relevant times during execution, and have the opportunity to confirm the operation by returning the appropriate argument value, modify the operation by altering the argument before returning and in some cases it is possible to trigger a 'reversion' by returning null. A reversion is where the operation is discarded and rerun. In the case of reversion, the life cycle method will be recalled in the same way during the rerun, allowing the life cycle listener the ability to revert indefinitely. It is worth noting that this leaves room for the potential of an infinite loop if any of these methods were defined to return null in all possible circumstances. The number of reversions for crossover and mutation is obtainable from the crossover stats and mutation stats respectively.


Constructor Summary
LifeCycleManager()
           
 
Method Summary
 void addCrossoverListener(CrossoverListener<TYPE> listener)
           
 void addElitismListener(ElitismListener<TYPE> listener)
           
 void addGenerationListener(GenerationListener listener)
           
 void addInitialisationListener(InitialisationListener<TYPE> listener)
           
 void addMutationListener(MutationListener<TYPE> listener)
           
 void addPoolSelectionListener(PoolSelectionListener<TYPE> listener)
           
 void addReproductionListener(ReproductionListener<TYPE> listener)
           
 void addRunListener(RunListener listener)
           
 void addTerminationListener(TerminationListener listener)
           
 CandidateProgram<TYPE>[] onCrossover(CandidateProgram<TYPE>[] parents, CandidateProgram<TYPE>[] children)
           
 java.util.List<CandidateProgram<TYPE>> onElitism(java.util.List<CandidateProgram<TYPE>> elites)
           
 void onFitnessTermination()
           
 void onGenerationStart()
           
 void onGenerationTermination()
           
 java.util.List<CandidateProgram<TYPE>> onInitialisation(java.util.List<CandidateProgram<TYPE>> pop)
           
 CandidateProgram<TYPE> onMutation(CandidateProgram<TYPE> parent, CandidateProgram<TYPE> child)
           
 java.util.List<CandidateProgram<TYPE>> onPoolSelection(java.util.List<CandidateProgram<TYPE>> pool)
           
 CandidateProgram<TYPE> onReproduction(CandidateProgram<TYPE> child)
           
 void onRunStart()
           
 void removeCrossoverListener(CrossoverListener<TYPE> listener)
           
 void removeElitismListener(ElitismListener<TYPE> listener)
           
 void removeGenerationListener(GenerationListener listener)
           
 void removeInitialisationListener(InitialisationListener<TYPE> listener)
           
 void removeMutationListener(MutationListener<TYPE> listener)
           
 void removePoolSelectionListener(PoolSelectionListener<TYPE> listener)
           
 void removeReproductionListener(ReproductionListener<TYPE> listener)
           
 void removeRunListener(RunListener listener)
           
 void removeTerminationListener(TerminationListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LifeCycleManager

public LifeCycleManager()
Method Detail

addRunListener

public void addRunListener(RunListener listener)

removeRunListener

public void removeRunListener(RunListener listener)

addInitialisationListener

public void addInitialisationListener(InitialisationListener<TYPE> listener)

removeInitialisationListener

public void removeInitialisationListener(InitialisationListener<TYPE> listener)

addElitismListener

public void addElitismListener(ElitismListener<TYPE> listener)

removeElitismListener

public void removeElitismListener(ElitismListener<TYPE> listener)

addPoolSelectionListener

public void addPoolSelectionListener(PoolSelectionListener<TYPE> listener)

removePoolSelectionListener

public void removePoolSelectionListener(PoolSelectionListener<TYPE> listener)

addCrossoverListener

public void addCrossoverListener(CrossoverListener<TYPE> listener)

removeCrossoverListener

public void removeCrossoverListener(CrossoverListener<TYPE> listener)

addMutationListener

public void addMutationListener(MutationListener<TYPE> listener)

removeMutationListener

public void removeMutationListener(MutationListener<TYPE> listener)

addReproductionListener

public void addReproductionListener(ReproductionListener<TYPE> listener)

removeReproductionListener

public void removeReproductionListener(ReproductionListener<TYPE> listener)

addGenerationListener

public void addGenerationListener(GenerationListener listener)

removeGenerationListener

public void removeGenerationListener(GenerationListener listener)

addTerminationListener

public void addTerminationListener(TerminationListener listener)

removeTerminationListener

public void removeTerminationListener(TerminationListener listener)

onRunStart

public void onRunStart()

onInitialisation

public java.util.List<CandidateProgram<TYPE>> onInitialisation(java.util.List<CandidateProgram<TYPE>> pop)

onElitism

public java.util.List<CandidateProgram<TYPE>> onElitism(java.util.List<CandidateProgram<TYPE>> elites)

onPoolSelection

public java.util.List<CandidateProgram<TYPE>> onPoolSelection(java.util.List<CandidateProgram<TYPE>> pool)

onCrossover

public CandidateProgram<TYPE>[] onCrossover(CandidateProgram<TYPE>[] parents,
                                            CandidateProgram<TYPE>[] children)

onMutation

public CandidateProgram<TYPE> onMutation(CandidateProgram<TYPE> parent,
                                         CandidateProgram<TYPE> child)

onReproduction

public CandidateProgram<TYPE> onReproduction(CandidateProgram<TYPE> child)

onGenerationStart

public void onGenerationStart()

onFitnessTermination

public void onFitnessTermination()

onGenerationTermination

public void onGenerationTermination()