Package org.biojavax.ga.functions
Interface CrossOverFunction
-
- All Superinterfaces:
Changeable
- All Known Implementing Classes:
AbstractCrossOverFunction,CrossOverFunction.NoCross,OrderCrossover,SimpleCrossOverFunction
public interface CrossOverFunction extends Changeable
Crosses 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 thesetChromosomePairmethod. Next you would call one of theperformCrossOvermethods to do the crossing and finally you would retreive the chromsome pair with thegetChromosomesmethod.- Since:
- 1.5
- Version:
- 1.0
- Author:
- Mark Schreiber
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classCrossOverFunction.NoCrossA place holder CrossOverFunction that doesn't perform cross overs
-
Field Summary
Fields Modifier and Type Field Description static ChangeTypeCROSS_PROBstatic double[]DEFAULT_CROSS_PROBstatic intDEFAULT_MAX_CROSSstatic ChangeTypeMAX_CROSSESstatic CrossOverFunctionNO_CROSS
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description double[]getCrossOverProbs()intgetMaxCrossOvers()GACrossResultperformCrossOver(SymbolList chromA, SymbolList chromB)Performs a cross between the pair of chromosomesvoidsetCrossOverProbs(double[] crossOverProbs)Sets the probability of crossing at each base.voidsetMaxCrossOvers(int maxCrossOvers)Sets an upper limit on the number of crosses.-
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
-
-
-
Field Detail
-
DEFAULT_MAX_CROSS
static final int DEFAULT_MAX_CROSS
- See Also:
- Constant Field Values
-
DEFAULT_CROSS_PROB
static final double[] DEFAULT_CROSS_PROB
-
MAX_CROSSES
static final ChangeType MAX_CROSSES
-
CROSS_PROB
static final ChangeType CROSS_PROB
-
NO_CROSS
static final CrossOverFunction NO_CROSS
-
-
Method Detail
-
performCrossOver
GACrossResult performCrossOver(SymbolList chromA, SymbolList chromB) throws ChangeVetoException
Performs a cross between the pair of chromosomes- Parameters:
chromA- The first chromosome in the crosschromB- The second chromosome in the cross- Returns:
- A
GACrossthat holds the results of the cross - Throws:
ChangeVetoException- if the chromosomes are unmodifiable
-
setMaxCrossOvers
void setMaxCrossOvers(int maxCrossOvers) throws ChangeVetoException
Sets 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.- Parameters:
maxCrossOvers- the limit on crosses- Throws:
ChangeVetoException- if a ChangeListener vetoes this change
-
getMaxCrossOvers
int getMaxCrossOvers()
- Returns:
- the limit on crosses.
-
setCrossOverProbs
void setCrossOverProbs(double[] crossOverProbs) throws ChangeVetoException
Sets 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 theSymbolListis given bycrossOverProbs[1].CrossOverProbs[0]is effectively redundant as the cross would occur before the 1st position in theSymbolList. 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 beDEFAULT_CROSS_PROB- Parameters:
crossOverProbs- an array of doubles giving the probability of a cross occuring at any place.- Throws:
ChangeVetoException
-
getCrossOverProbs
double[] getCrossOverProbs()
-
-