- All Superinterfaces:
- All Known Implementing Classes:
public interface CrossOverFunction extends ChangeableCrosses two chromosomes. The basic usage of the class would be something like choosing two chromosomes that you want to cross over and setting these with the
setChromosomePairmethod. Next you would call one of the
performCrossOvermethods to do the crossing and finally you would retreive the chromsome pair with the
- Mark Schreiber
Nested Class Summary
Nested Classes Modifier and Type Interface Description
CrossOverFunction.NoCrossA place holder CrossOverFunction that doesn't perform cross overs
All Methods Instance Methods Abstract Methods Modifier and Type Method Description
performCrossOver(SymbolList chromA, SymbolList chromB)Performs a cross between the pair of chromosomes
setCrossOverProbs(double crossOverProbs)Sets the probability of crossing at each base.
setMaxCrossOvers(int maxCrossOvers)Sets an upper limit on the number of crosses.
static final double DEFAULT_CROSS_PROB
GACrossResult performCrossOver(SymbolList chromA, SymbolList chromB) throws ChangeVetoExceptionPerforms a cross between the pair of chromosomes
chromA- The first chromosome in the cross
chromB- The second chromosome in the cross
GACrossthat holds the results of the cross
ChangeVetoException- if the chromosomes are unmodifiable
void setMaxCrossOvers(int maxCrossOvers) throws ChangeVetoExceptionSets an upper limit on the number of crosses. Its up to the implementation to decide what to do when the limit is reached although a good convention would be to keep only the first N crosses from the left end (5' end) of the sequence. By convention the default upper limit is DEFAULT_MAX_CROSS (eg infinite). This value should be used as the default by all implementations.
maxCrossOvers- the limit on crosses
ChangeVetoException- if a ChangeListener vetoes this change
- the limit on crosses.
void setCrossOverProbs(double crossOverProbs) throws ChangeVetoExceptionSets the probability of crossing at each base. Each position in the array corresponds to a position in the sequences to be crossed. The probability of a cross occuring after position 1 in the
SymbolListis given by
CrossOverProbsis effectively redundant as the cross would occur before the 1st position in the
SymbolList. By convention if the array is shorter than the SymbolList it is being applied to then the last value in the array will be applied to every subsequent residue. The default value in all implementations should be
crossOverProbs- an array of doubles giving the probability of a cross occuring at any place.