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 SymbolList
createBinary(String binarySequence)
Creates aSymbolList
in the GABinaryAlphabet
static FiniteAlphabet
getBinaryAlphabet()
Gets a Reference to the FlyWeight GA_BinaryAlphabet
.static AtomicSymbol
one()
static OrderNDistribution
standardMutationDistribution(FiniteAlphabet a)
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
uniformMutationDistribution(FiniteAlphabet a)
Makes a 1st order distribution which is infact uniform (equivalent to a uniform zero order distribution).static AtomicSymbol
zero()
-
-
-
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 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
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 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
-
-