From e9290a500b228e2561a8537adbc13e86f1356747 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Sat, 15 Feb 2014 21:43:35 +0000 Subject: Population and Chromosome classes refactored so that EAs are easier to implement. --- src/jcgp/Parameters.java | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'src/jcgp/Parameters.java') diff --git a/src/jcgp/Parameters.java b/src/jcgp/Parameters.java index 26eb61c..0a6abd9 100644 --- a/src/jcgp/Parameters.java +++ b/src/jcgp/Parameters.java @@ -2,11 +2,12 @@ package jcgp; public class Parameters { - private static int rows, columns, inputs, outputs, levelsBack, - mutationRate, populationSize, totalGenerations, - currentGeneration = 0, totalRuns, currentRun = 0, - maxArity, maxFitness; + private static int rows = 0, columns = 0, inputs = 0, outputs = 0, levelsBack = 0, + mutationRate = 0, totalGenerations = 0, parents = 0, offspring = 0, + currentGeneration = 0, totalRuns = 0, currentRun = 0, + maxArity = 0, maxFitness = 0; + public static int getRows() { return rows; } @@ -36,9 +37,17 @@ public class Parameters { } public static int getPopulationSize() { - return populationSize; + return offspring + parents; } - + + public static int getOffspringCount() { + return offspring; + } + + public static int getParentCount() { + return parents; + } + public static int getTotalGenerations() { return totalGenerations; } @@ -87,8 +96,17 @@ public class Parameters { Parameters.mutationRate = mutationRate; } - public static void setPopulationSize(int populationSize) { - Parameters.populationSize = populationSize; + public static void setPopulationSize(int parents, int offspring) { + Parameters.parents = parents; + Parameters.offspring = offspring; + } + + public static void setOffspringCount(int offspring) { + Parameters.offspring = offspring; + } + + public static void setParentCount(int parents) { + Parameters.parents = parents; } public static void setTotalGenerations(int totalGenerations) { -- cgit v1.2.3