Class GATools


  • public final class GATools
    extends java.lang.Object

    Utility methods for the GA library

    Since:
    1.5
    Version:
    1.0
    Author:
    Mark Schreiber
    • Constructor Detail

      • GATools

        public GATools()
    • Method Detail

      • getBinaryAlphabet

        public static FiniteAlphabet getBinaryAlphabet()
        Gets a Reference to the FlyWeight GA_Binary Alphabet. 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​(java.lang.String binarySequence)
                                       throws IllegalSymbolException
        Creates a SymbolList in the GABinary Alphabet
        Parameters:
        binarySequence - a String like "01010000101010101" with no white space
        Returns:
        a SymbolList parsed from binarySequence
        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 from a.
      • standardMutationDistribution

        public static OrderNDistribution standardMutationDistribution​(FiniteAlphabet a)
                                                               throws IllegalAlphabetException
        Makes a mutation Distribution where the probability of a Symbol being mutated to itself is zero and the probability of it being changed to any other Symbol in the Alphabet a is 1.0 / (a.size() - 1.0)
        Parameters:
        a - the FiniteAlphabet which mutations are sampled from.
        Returns:
        A Distribution suitable for use in a MutationFunction
        Throws:
        IllegalAlphabetException - if the Distribution cannot be made over the FiniteAlphabet