GenomeType
- Type of genome used to represent a single element in the
genetic population, such as a Vector, for example@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 java.lang.Object implements Reproducer<GenomeType>
Constructor and Description |
---|
CrossoverReproducer(Selector<GenomeType> selector,
CrossoverFunction<GenomeType> crossoverFunction)
Creates a new instance of CrossoverReproducer
|
Modifier and Type | Method and Description |
---|---|
CrossoverFunction<GenomeType> |
getCrossoverFunction()
Gets the CrossoverFunction.
|
Selector<GenomeType> |
getSelector()
Gets the selector.
|
java.util.ArrayList<GenomeType> |
reproduce(java.util.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.
|
public CrossoverReproducer(Selector<GenomeType> selector, CrossoverFunction<GenomeType> crossoverFunction)
selector
- The selector for the population to use.crossoverFunction
- The crossover function to use.public java.util.ArrayList<GenomeType> reproduce(java.util.Collection<EvaluatedGenome<GenomeType>> genomes)
reproduce
in interface Reproducer<GenomeType>
genomes
- The population to reproduce.public Selector<GenomeType> getSelector()
public CrossoverFunction<GenomeType> getCrossoverFunction()
public void setSelector(Selector<GenomeType> selector)
selector
- The new selector.public void setCrossoverFunction(CrossoverFunction<GenomeType> crossoverFunction)
crossoverFunction
- The new CrossoverFunction.