Package org.biojavax.ga.util
Class GATools
- java.lang.Object
-
- org.biojavax.ga.util.GATools
-
-
Constructor Summary
Constructors Constructor Description GATools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SymbolListcreateBinary(String binarySequence)Creates aSymbolListin the GABinaryAlphabetstatic FiniteAlphabetgetBinaryAlphabet()Gets a Reference to the FlyWeight GA_BinaryAlphabet.static AtomicSymbolone()static OrderNDistributionstandardMutationDistribution(FiniteAlphabet a)Makes a mutationDistributionwhere the probability of aSymbolbeing mutated to itself is zero and the probability of it being changed to any otherSymbolin theAlphabet ais1.0 / (a.size() - 1.0)static OrderNDistributionuniformMutationDistribution(FiniteAlphabet a)Makes a 1st order distribution which is infact uniform (equivalent to a uniform zero order distribution).static AtomicSymbolzero()
-
-
-
Constructor Detail
-
GATools
public GATools()
-
-
Method Detail
-
getBinaryAlphabet
public static FiniteAlphabet getBinaryAlphabet()
Gets a Reference to the FlyWeight GA_BinaryAlphabet. It contains the Symbols one and zero.- Returns:
- the finite, flyweight Binary Alphabet
-
one
public static AtomicSymbol one()
- Returns:
- the GA_Binary symbol "one"
-
createBinary
public static SymbolList createBinary(String binarySequence) throws IllegalSymbolException
Creates aSymbolListin the GABinaryAlphabet- Parameters:
binarySequence- a String like "01010000101010101" with no white space- Returns:
- a
SymbolListparsed frombinarySequence - Throws:
IllegalSymbolException- if a character other than 1 or 0 is found.
-
zero
public static AtomicSymbol zero()
- Returns:
- the GA_Binary symbol "zero"
-
uniformMutationDistribution
public static OrderNDistribution uniformMutationDistribution(FiniteAlphabet a) throws IllegalAlphabetException
Makes a 1st order distribution which is infact uniform (equivalent to a uniform zero order distribution).- Parameters:
a- the zero order Alphabet which will be multiplied into the 1st order alphabet- Returns:
- the "1st order" distribution
- Throws:
IllegalAlphabetException- if the Distribution cannot be constructed froma.
-
standardMutationDistribution
public static OrderNDistribution standardMutationDistribution(FiniteAlphabet a) throws IllegalAlphabetException
Makes a mutationDistributionwhere the probability of aSymbolbeing mutated to itself is zero and the probability of it being changed to any otherSymbolin theAlphabet ais1.0 / (a.size() - 1.0)- Parameters:
a- theFiniteAlphabetwhich mutations are sampled from.- Returns:
- A
Distributionsuitable for use in aMutationFunction - Throws:
IllegalAlphabetException- if theDistributioncannot be made over theFiniteAlphabet
-
-