Package org.biojavax.ga.util
Class GATools
java.lang.Object
org.biojavax.ga.util.GATools
Utility methods for the GA library
- Since:
- 1.5
- Version:
- 1.0
- Author:
- Mark Schreiber
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SymbolListcreateBinary(String binarySequence) Creates aSymbolListin the GABinaryAlphabetstatic FiniteAlphabetGets a Reference to the FlyWeight GA_BinaryAlphabet.static AtomicSymbolone()static OrderNDistributionMakes 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 OrderNDistributionMakes a 1st order distribution which is infact uniform (equivalent to a uniform zero order distribution).static AtomicSymbolzero()
-
Constructor Details
-
GATools
public GATools()
-
-
Method Details
-
getBinaryAlphabet
Gets a Reference to the FlyWeight GA_BinaryAlphabet. It contains the Symbols one and zero.- Returns:
- the finite, flyweight Binary Alphabet
-
one
- Returns:
- the GA_Binary symbol "one"
-
createBinary
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
- 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
-