Package adams.core.discovery.genetic
Class GeneticHelper
- java.lang.Object
-
- adams.core.discovery.genetic.GeneticHelper
-
- Direct Known Subclasses:
WekaGeneticHelper
public class GeneticHelper extends Object
Helper class for bit-string related operations.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description GeneticHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doublebitsToDouble(String bits, double min, double max, int splits)Turns a bit string (0s and 1s) into a double.static floatbitsToFloat(String bits, double min, double max, int splits)Turns a bit string (0s and 1s) into a double.static intbitsToInt(String bits, int min, int max)Turns the bit string back into an integer.static int[]bitsToIntArray(String bits, int min, int max, int numBits, int size)Turns a bit string (0s and 1s) into an integer array.static StringdoubleToBits(double in, double min, double max, int numBits, int splits)Turns a double into a bit string (0s and 1s).static StringfloatToBits(float in, float min, float max, int numBits, int splits)Turns a double into a bit string (0s and 1s).static StringintArrayToBits(int[] ina, int min, int max, int numBits)Creates a bit string (0s and 1s) from an integer array.static StringintToBits(int in, int min, int max, int numBits)Turns an integer into a bitstring (0s and 1s).
-
-
-
Method Detail
-
bitsToInt
public static int bitsToInt(String bits, int min, int max)
Turns the bit string back into an integer.- Parameters:
bits- the bit string (0s and 1s)min- the minimummax- the maximum- Returns:
- the integer
-
intToBits
public static String intToBits(int in, int min, int max, int numBits)
Turns an integer into a bitstring (0s and 1s).- Parameters:
in- the integer to convertmin- the minimummax- the maximumnumBits- the number of bits- Returns:
- the bit string
-
bitsToIntArray
public static int[] bitsToIntArray(String bits, int min, int max, int numBits, int size)
Turns a bit string (0s and 1s) into an integer array.- Parameters:
bits- the stringmin- the minimummax- the maximumnumBits- the number of bitssize- the size of the array- Returns:
- the reconstructed integer array
-
intArrayToBits
public static String intArrayToBits(int[] ina, int min, int max, int numBits)
Creates a bit string (0s and 1s) from an integer array.- Parameters:
ina- the integer arraymin- the minimummax- the maximumnumBits- the number of bits- Returns:
- the bit string
-
bitsToDouble
public static double bitsToDouble(String bits, double min, double max, int splits)
Turns a bit string (0s and 1s) into a double.- Parameters:
bits- the bit stringmin- the minimummax- the maximumsplits- the number of splits- Returns:
- the reconstructed double value
-
bitsToFloat
public static float bitsToFloat(String bits, double min, double max, int splits)
Turns a bit string (0s and 1s) into a double.- Parameters:
bits- the bit stringmin- the minimummax- the maximumsplits- the number of splits- Returns:
- the reconstructed double value
-
doubleToBits
public static String doubleToBits(double in, double min, double max, int numBits, int splits)
Turns a double into a bit string (0s and 1s).- Parameters:
in- the double valuemin- the minimummax- the maximumnumBits- the number of bitssplits- the number of splits- Returns:
- the generated bit string
-
floatToBits
public static String floatToBits(float in, float min, float max, int numBits, int splits)
Turns a double into a bit string (0s and 1s).- Parameters:
in- the double valuemin- the minimummax- the maximumnumBits- the number of bitssplits- the number of splits- Returns:
- the generated bit string
-
-