com.epochx.core
Class GPInitialisation<TYPE>

java.lang.Object
  extended by com.epochx.core.GPInitialisation<TYPE>

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

This class is responsible for controlling the initialisation operation. Note that as with the other core classes, no actual (initialisation) operation is performed by this class. Rather, it provides the infrastructure around the operation, and calls the implementation of Initialiser which will perform the actual operation.

See Also:
Initialiser, FullInitialiser, RampedHalfAndHalfInitialiser

Constructor Summary
GPInitialisation(GPModel<TYPE> model)
          Constructs an instance of GEInitialisation which will setup the initialisation operation.
 
Method Summary
 int getReversions()
          Number of times the initial population was rejected and regenerated.
 java.util.List<CandidateProgram<TYPE>> initialise()
          Initialises a new population of CandidatePrograms by calling getInitialPopulation() on the initialiser provided by the model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GPInitialisation

public GPInitialisation(GPModel<TYPE> model)
Constructs an instance of GEInitialisation which will setup the initialisation operation. Note that the actual initialisation operation will be performed by the subclass of Initialiser returned by the models getInitialiser() method.

Parameters:
model - the GPModel which defines the Initialiser operator and life cycle listener.
See Also:
Initialiser
Method Detail

initialise

public java.util.List<CandidateProgram<TYPE>> initialise()
Initialises a new population of CandidatePrograms by calling getInitialPopulation() on the initialiser provided by the model.

After an initial population is constructed, the model's life cycle listener is given an opportunity to confirm or modify it before proceeding. The listener's onInitialisation() method is called, passing it the newly formed population. If this method returns null then the initialisation operation will be repeated, otherwise the population returned by the life cycle listener will be used as the initial population. The number of times the initial population is rejected and thus regenerated is available with a call to getReversions().

Returns:
a List of CandidatePrograms generated by the model's initialiser.

getReversions

public int getReversions()
Number of times the initial population was rejected and regenerated.

After an initial population is constructed, the model's life cycle listener is given an opportunity to confirm or modify it before proceeding. The listener's onInitialisation() method is called, passing it the newly formed population. If this method returns null then the initialisation operation will be repeated, otherwise the population returned by the life cycle listener will be used as the initial population. The number of times the initial population is rejected and thus regenerated is available with a call to this method.

Returns:
the number of times the intialisation was rejected by the life cycle listener.