JavaGenes, NASA Ames. Written largely by Al Globus

gov.nasa.javaGenes.evolvableDoubleList
Class Crossover

java.lang.Object
  extended bygov.nasa.javaGenes.core.ChildMaker
      extended bygov.nasa.javaGenes.evolvableDoubleList.ChildMaker
          extended bygov.nasa.javaGenes.evolvableDoubleList.Crossover
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
CrossoverOnePoint, CrossoverTwoPoints

public class Crossover
extends ChildMaker

contains useful stuff for one and two point crossover classes

See Also:
Serialized Form

Field Summary
 
Fields inherited from class gov.nasa.javaGenes.evolvableDoubleList.ChildMaker
selector
 
Fields inherited from class gov.nasa.javaGenes.core.ChildMaker
cumulative, forEvolution, last
 
Constructor Summary
Crossover(NeighboringPairsSelector selector)
           
 
Method Summary
protected  void crossover(EvolvableDoubleList child, EvolvableDoubleList parentOne, EvolvableDoubleList parentTwo, int[] parentOneIndices, int[] parentTwoIndices)
           
protected  int[] getFirstParentIndicesArray(Evolvable[] parents)
           
protected  int[] getIndicesArray(EvolvableDoubleList parent)
           
 NeighboringPairsSelector getNeighboringPairsSelector()
           
protected  int[] getSecondParentIndicesArray(Evolvable[] parents)
           
 EvolvableDoubleList getSmallerParent(Evolvable[] parents)
           
 Evolvable[] makeChildren(Evolvable[] parents)
          Defaults to mutation, any subclass wanting more than one parent must over-ride.
 int numberOfParents()
           
 
Methods inherited from class gov.nasa.javaGenes.evolvableDoubleList.ChildMaker
getSelector
 
Methods inherited from class gov.nasa.javaGenes.core.ChildMaker
checkLastResults, checkResults, clearLast, getAndClearLastTabSeparatedResults, getFitnessFunctionNames, getLastTabSeparatedResults, headerFragment, makeChildren, mutate, neverUsed, proportionDown, results, setFitnessFunction, setFitnessFunctionNames, subClassMeasures, tabSeparatedResults, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Crossover

public Crossover(NeighboringPairsSelector selector)
Method Detail

makeChildren

public Evolvable[] makeChildren(Evolvable[] parents)
Description copied from class: ChildMaker
Defaults to mutation, any subclass wanting more than one parent must over-ride. Mutators can over-ride mutate(Evovlable)

Overrides:
makeChildren in class ChildMaker
Parameters:
parents - the evolvables from which children will be created. By convention, the parents are not modified.
Returns:
the children created. Subclass must implement copyForEvolution()

crossover

protected void crossover(EvolvableDoubleList child,
                         EvolvableDoubleList parentOne,
                         EvolvableDoubleList parentTwo,
                         int[] parentOneIndices,
                         int[] parentTwoIndices)

getFirstParentIndicesArray

protected int[] getFirstParentIndicesArray(Evolvable[] parents)
Returns:
indicies come in neighboring pairs. The crossover points are in between each pair. The default is use same indices for both parents.

getSecondParentIndicesArray

protected int[] getSecondParentIndicesArray(Evolvable[] parents)
Returns:
indicies come in neighboring pairs. The crossover points are in between each pair. The default is use same indices for both parents.

getIndicesArray

protected int[] getIndicesArray(EvolvableDoubleList parent)

getSmallerParent

public EvolvableDoubleList getSmallerParent(Evolvable[] parents)

getNeighboringPairsSelector

public NeighboringPairsSelector getNeighboringPairsSelector()

numberOfParents

public int numberOfParents()
Overrides:
numberOfParents in class ChildMaker
Returns:
the number of parents makeChildren expects. I.e., the length of the array passed to makeChildren. If not implemented by subclass, defaults to 1 (mutation).

JavaGenes, NASA Ames. Written largely by Al Globus