com.epochx.core
Class GPPoolSelection<TYPE>

java.lang.Object
  extended by com.epochx.core.GPPoolSelection<TYPE>
All Implemented Interfaces:
GenerationListener

public class GPPoolSelection<TYPE>
extends java.lang.Object
implements GenerationListener

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

See Also:
PoolSelector, TournamentSelector

Constructor Summary
GPPoolSelection(GPModel<TYPE> model)
          Constructs an instance of GPPoolSelection which will setup the breeding pool selection operation.
 
Method Summary
 java.util.List<CandidateProgram<TYPE>> getPool(java.util.List<CandidateProgram<TYPE>> pop)
           
 int getReversions()
          Number of times the selected pool was rejected and re-selected.
 void onGenerationStart()
          Called after each generation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GPPoolSelection

public GPPoolSelection(GPModel<TYPE> model)
Constructs an instance of GPPoolSelection which will setup the breeding pool selection operation. Note that the actual construction of the pool will be performed by the subclass of PoolSelector returned by the models getPoolSelector() method.

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

getPool

public java.util.List<CandidateProgram<TYPE>> getPool(java.util.List<CandidateProgram<TYPE>> pop)
Parameters:
pop -
Returns:

getReversions

public int getReversions()
Number of times the selected pool was rejected and re-selected.

After a breeding pool is selected, the controlling model's life cycle listener is requested to confirm the pool by a call to onPoolSelection(). This gives the model total control over the breeding pool allowing manipulation of it's contents before proceeding. If onPoolSelection() returns null then the pool of programs is discarded and a new pool is formed. The number of times the pool is reverted before being accepted is available through a call to this method.

Returns:
the number of times the selected breeding pool was rejected by the model.

onGenerationStart

public void onGenerationStart()
Called after each generation. For each generation we should reset all parameters taken from the model incase they've changed. The generation event is then CONFIRMed.

Specified by:
onGenerationStart in interface GenerationListener