gov.sandia.cognition.learning.algorithm.genetic.reproducer
Class CrossoverReproducer<GenomeType>

java.lang.Object
  extended by gov.sandia.cognition.learning.algorithm.genetic.reproducer.CrossoverReproducer<GenomeType>
Type Parameters:
GenomeType - Type of genome used to represent a single element in the genetic population, such as a Vector, for example
All Implemented Interfaces:
Reproducer<GenomeType>, Serializable

@CodeReviews(reviews={@CodeReview(reviewer="Kevin R. Dixon",date="2008-07-23",changesNeeded=false,comments={"This class still has open task from last code review, but I suspect it\'s due to lack of interest.","Moved previous code review to CodeReview annotation","Otherwise, looks fine."}),@CodeReview(reviewer="Justin Basilico",date="2006-10-04",changesNeeded=false,comments={"Class looks fine.","It may want to include some randomness in case the selector that it calls is deterministic and returns the same population twice."})})
public class CrossoverReproducer<GenomeType>
extends Object
implements Reproducer<GenomeType>

The CrossoverReproducer takes a population of genomes, and applies the supplied CrossoverFunction to produce a new population.

Since:
1.0
Author:
Justin Basilico, Jonathan McClain
See Also:
Serialized Form

Constructor Summary
CrossoverReproducer(Selector<GenomeType> selector, CrossoverFunction<GenomeType> crossoverFunction)
          Creates a new instance of CrossoverReproducer
 
Method Summary
 CrossoverFunction<GenomeType> getCrossoverFunction()
          Gets the CrossoverFunction.
 Selector<GenomeType> getSelector()
          Gets the selector.
 ArrayList<GenomeType> reproduce(Collection<EvaluatedGenome<GenomeType>> genomes)
          Produces a new population of genomes from the supplied population using crossover.
 void setCrossoverFunction(CrossoverFunction<GenomeType> crossoverFunction)
          Sets the CrossoverFunction.
 void setSelector(Selector<GenomeType> selector)
          Sets the selector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrossoverReproducer

public CrossoverReproducer(Selector<GenomeType> selector,
                           CrossoverFunction<GenomeType> crossoverFunction)
Creates a new instance of CrossoverReproducer

Parameters:
selector - The selector for the population to use.
crossoverFunction - The crossover function to use.
Method Detail

reproduce

public ArrayList<GenomeType> reproduce(Collection<EvaluatedGenome<GenomeType>> genomes)
Produces a new population of genomes from the supplied population using crossover. It works by using the selector to select two sets of genomes and then crosses them over.

Specified by:
reproduce in interface Reproducer<GenomeType>
Parameters:
genomes - The population to reproduce.
Returns:
The new population.

getSelector

public Selector<GenomeType> getSelector()
Gets the selector.

Returns:
The selector.

getCrossoverFunction

public CrossoverFunction<GenomeType> getCrossoverFunction()
Gets the CrossoverFunction.

Returns:
The CrossoverFunction.

setSelector

public void setSelector(Selector<GenomeType> selector)
Sets the selector.

Parameters:
selector - The new selector.

setCrossoverFunction

public void setCrossoverFunction(CrossoverFunction<GenomeType> crossoverFunction)
Sets the CrossoverFunction.

Parameters:
crossoverFunction - The new CrossoverFunction.