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 SymbolList
createBinary
(String binarySequence) Creates aSymbolList
in the GABinaryAlphabet
static FiniteAlphabet
Gets a Reference to the FlyWeight GA_BinaryAlphabet
.static AtomicSymbol
one()
static OrderNDistribution
Makes a mutationDistribution
where the probability of aSymbol
being mutated to itself is zero and the probability of it being changed to any otherSymbol
in theAlphabet a
is1.0 / (a.size() - 1.0)
static OrderNDistribution
Makes a 1st order distribution which is infact uniform (equivalent to a uniform zero order distribution).static AtomicSymbol
zero()
-
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 aSymbolList
in the GABinaryAlphabet
- Parameters:
binarySequence
- a String like "01010000101010101" with no white space- Returns:
- a
SymbolList
parsed 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 mutationDistribution
where the probability of aSymbol
being mutated to itself is zero and the probability of it being changed to any otherSymbol
in theAlphabet a
is1.0 / (a.size() - 1.0)
- Parameters:
a
- theFiniteAlphabet
which mutations are sampled from.- Returns:
- A
Distribution
suitable for use in aMutationFunction
- Throws:
IllegalAlphabetException
- if theDistribution
cannot be made over theFiniteAlphabet
-