Class Clustering
java.lang.Object
net.bmahe.genetics4j.samples.clustering.Clustering
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final double
static final double
static final double
static final int
static final int
static final int
static final double
static final org.apache.logging.log4j.Logger
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic List
<org.apache.commons.math3.ml.clustering.CentroidCluster<LocationWrapper>> apacheCommonsMathCluster
(double[][] clusters, double[][] data) static void
private static final double[][]
computeAllDistances
(double[][] array) private static final double
computeDistance
(double[][] array, int i, int j) static void
doGA
(int k, double min, double max, int numberTournaments, int combinationArithmetic, int combinationCrossover, double randomMutationRate, double creepMutationRate, double creepMutationMean, double creepMutationStdDev, Fitness<Double> fitnessFunction, Termination<Double> terminations, int populationSize, String outputCSV, double[][] data, double[][] distances, String baseDir, String filenameSuffix) static double[][]
generateClusters
(Random random, int numClusters, double minX, double maxX, double minY, double maxY) static double[][]
generateDataPoints
(Random random, double[][] clusters, int numDataPoints, double radius) static void
-
Field Details
-
logger
public static final org.apache.logging.log4j.Logger logger -
DEFAULT_NUM_CLUSTERS
public static final int DEFAULT_NUM_CLUSTERS- See Also:
-
DEFAULT_NUMBER_TOURNAMENTS
public static final int DEFAULT_NUMBER_TOURNAMENTS- See Also:
-
DEFAULT_POPULATION_SIZE
public static final int DEFAULT_POPULATION_SIZE- See Also:
-
DEFAULT_RANDOM_MUTATION_RATE
public static final double DEFAULT_RANDOM_MUTATION_RATE- See Also:
-
DEFAULT_CREEP_MUTATION_RATE
public static final double DEFAULT_CREEP_MUTATION_RATE- See Also:
-
DEFAULT_CREEP_MUTATION_MEAN
public static final double DEFAULT_CREEP_MUTATION_MEAN- See Also:
-
DEFAULT_CREEP_MUTATION_STDDEV
public static final double DEFAULT_CREEP_MUTATION_STDDEV- See Also:
-
DEFAULT_COMBINATION_ARITHMETIC
public static final int DEFAULT_COMBINATION_ARITHMETIC- See Also:
-
DEFAULT_COMBINATION_CROSSOVER_ARITHMETIC
public static final int DEFAULT_COMBINATION_CROSSOVER_ARITHMETIC- See Also:
-
PARAM_NUM_CLUSTERS
- See Also:
-
LONG_PARAM_NUM_CLUSTERS
- See Also:
-
PARAM_NUMBER_TOURNAMENTS
- See Also:
-
LONG_PARAM_NUMBER_TOURNAMENTS
- See Also:
-
PARAM_POPULATION_SIZE
- See Also:
-
LONG_PARAM_POPULATION_SIZE
- See Also:
-
PARAM_SOURCE_CLUSTERS_CSV
- See Also:
-
LONG_PARAM_SOURCE_CUSTERS_CSV
- See Also:
-
PARAM_SOURCE_DATA_CSV
- See Also:
-
LONG_PARAM_SOURCE_DATA_CSV
- See Also:
-
PARAM_FIXED_TERMINATION
- See Also:
-
LONG_PARAM_FIXED_TERMINATION
- See Also:
-
PARAM_RANDOM_MUTATION_RATE
- See Also:
-
LONG_PARAM_RANDOM_MUTATION_RATE
- See Also:
-
PARAM_CREEP_MUTATION_RATE
- See Also:
-
LONG_PARAM_CREEP_MUTATION_RATE
- See Also:
-
PARAM_CREEP_MUTATION_MEAN
- See Also:
-
LONG_PARAM_CREEP_MUTATION_MEAN
- See Also:
-
PARAM_CREEP_MUTATION_STD_DEV
- See Also:
-
LONG_PARAM_CREEP_MUTATION_STD_DEV
- See Also:
-
PARAM_COMBINATION_ARITHMETIC
- See Also:
-
LONG_PARAM_COMBINATION_ARITHMETIC
- See Also:
-
PARAM_COMBINATION_CROSSOVER
- See Also:
-
LONG_PARAM_COMBINATION_CROSSOVER
- See Also:
-
PARAM_OUTPUT_CSV
- See Also:
-
LONG_PARAM_OUTPUT_CSV
- See Also:
-
PARAM_OUTPUT_WITH_SSE_CSV
- See Also:
-
LONG_PARAM_OUTPUT_WITH_SSE_CSV
- See Also:
-
PARAM_BASE_DIR_OUTPUT
- See Also:
-
LONG_PARAM_BASE_DIR_OUTPUT
- See Also:
-
-
Constructor Details
-
Clustering
public Clustering()
-
-
Method Details
-
cliError
-
computeDistance
private static final double computeDistance(double[][] array, int i, int j) -
computeAllDistances
private static final double[][] computeAllDistances(double[][] array) -
generateClusters
public static double[][] generateClusters(Random random, int numClusters, double minX, double maxX, double minY, double maxY) -
generateDataPoints
public static double[][] generateDataPoints(Random random, double[][] clusters, int numDataPoints, double radius) -
doGA
public static void doGA(int k, double min, double max, int numberTournaments, int combinationArithmetic, int combinationCrossover, double randomMutationRate, double creepMutationRate, double creepMutationMean, double creepMutationStdDev, Fitness<Double> fitnessFunction, Termination<Double> terminations, int populationSize, String outputCSV, double[][] data, double[][] distances, String baseDir, String filenameSuffix) throws IOException - Throws:
IOException
-
apacheCommonsMathCluster
public static List<org.apache.commons.math3.ml.clustering.CentroidCluster<LocationWrapper>> apacheCommonsMathCluster(double[][] clusters, double[][] data) -
main
- Throws:
IOException
-