com.epochx.op.crossover
Class UniformPointCrossover<TYPE>

java.lang.Object
  extended by com.epochx.op.crossover.UniformPointCrossover<TYPE>
All Implemented Interfaces:
GenerationListener, Crossover<TYPE>

public class UniformPointCrossover<TYPE>
extends java.lang.Object
implements Crossover<TYPE>, GenerationListener

This class implements standard crossover with uniform swap points.


Constructor Summary
UniformPointCrossover(GPModel<TYPE> model)
           
 
Method Summary
 CandidateProgram<TYPE>[] crossover(CandidateProgram<TYPE> program1, CandidateProgram<TYPE> program2)
          Crossover the two CandidatePrograms provided as arguments using uniform swap points.
 void onGenerationStart()
          Called at the start of each generation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniformPointCrossover

public UniformPointCrossover(GPModel<TYPE> model)
Method Detail

crossover

public CandidateProgram<TYPE>[] crossover(CandidateProgram<TYPE> program1,
                                          CandidateProgram<TYPE> program2)
Crossover the two CandidatePrograms provided as arguments using uniform swap points. Random crossover points are chosen at random in both programs, the genetic material at the points are then exchanged. The resulting programs are returned as new CandidateProgram objects.

Specified by:
crossover in interface Crossover<TYPE>
Parameters:
program1 - The first CandidateProgram selected to undergo uniform point crossover.
program2 - The second CandidateProgram selected to undergo uniform point crossover.
Returns:
An array of the child CandidatePrograms that were the result of an exchange of genetic material between the two parents.

onGenerationStart

public void onGenerationStart()
Description copied from interface: GenerationListener
Called at the start of each generation. Note that this method is called before the generation statistics are generated so any generation statistics will be created based upon the population returned here.

Specified by:
onGenerationStart in interface GenerationListener