jaga.evolve
Class SinglePointXOver
java.lang.Object
|
+--jaga.evolve.SinglePointXOver
- All Implemented Interfaces:
- GeneticOperator, java.io.Serializable
- public class SinglePointXOver
- extends java.lang.Object
- implements GeneticOperator
Performs sexual single point cross over on a pair of individuals to create another.
It handles variable length genotypes.
- See Also:
- Serialized Form
Method Summary |
void |
operate(Selector selector,
Population oldPopulation,
Population newPopulation,
int howMany)
method that adds genotypes to the new population by extracting some
from the old one and manipulating them in some way. |
void |
shiftOver(int pos,
BitSet childMum,
BitSet dad)
unconventional sexual reproduction between genotypes:
first genotype gets shifted to allow space for part of second
one to replace hole. |
java.lang.String |
toString()
|
void |
xOver(int pos,
BitSet childMum,
BitSet dad)
performs genotype cross over between two bitsets |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
SinglePointXOver
public SinglePointXOver()
xOver
public void xOver(int pos,
BitSet childMum,
BitSet dad)
- performs genotype cross over between two bitsets
- Parameters:
pos
- position at which to cross overchildMum
- in/out parameter who is one of parents and will also be childdad
- in parameter, the other parent
operate
public void operate(Selector selector,
Population oldPopulation,
Population newPopulation,
int howMany)
- method that adds genotypes to the new population by extracting some
from the old one and manipulating them in some way.
- Specified by:
operate
in interface GeneticOperator
- Parameters:
oldPopulation
- in parameter having all the original genotypesnewPopulation
- in/out parameter where the next generation of genotypes is being builthowMany
- how many new genotypes to add to the new population
shiftOver
public void shiftOver(int pos,
BitSet childMum,
BitSet dad)
- unconventional sexual reproduction between genotypes:
first genotype gets shifted to allow space for part of second
one to replace hole. Makes sense when logic can be more useful in
different parts of the genotype.
- Parameters:
pos
- position at which to shift overchildMum
- in/out parameter who is one of parents and will also be childdad
- in parameter, the other parent
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object