diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-01-31 13:06:54 +0000 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-01-31 13:06:54 +0000 |
commit | a02f1fff03ab58416da812597e67a0c7e21fdbd5 (patch) | |
tree | 0192f0db1d1bc8d6d29433f4e84d4c94a89ed2ac /src/jcgp/population/Chromosome.java | |
parent | 8f7874fa75c532bab994af8e6553d37afe42ec4c (diff) |
Created most of the classes that will be necessary, content is blank for now.
Diffstat (limited to 'src/jcgp/population/Chromosome.java')
-rw-r--r-- | src/jcgp/population/Chromosome.java | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/jcgp/population/Chromosome.java b/src/jcgp/population/Chromosome.java new file mode 100644 index 0000000..2e22cf9 --- /dev/null +++ b/src/jcgp/population/Chromosome.java @@ -0,0 +1,89 @@ +package jcgp.population; + +import java.util.ArrayList; + +public class Chromosome { + + private ArrayList<Input> inputs; + private ArrayList<ArrayList<Node>> nodes; + private ArrayList<Output> outputs; + + private int fitness = 0; + + /** + * Good citizen. + * @param outputs + * @param columns + * @param rows + * @param inputs + * + */ + public Chromosome(int inputCount, int rows, int columns, int outputCount) { + + inputs = new ArrayList<Input>(inputCount); + for (int i = 0; i < inputCount; i++) { + inputs.add(new Input()); + } + + // rows first + nodes = new ArrayList<ArrayList<Node>>(rows); + for (int r = 0; r < rows; r++) { + nodes.add(new ArrayList<Node>(columns)); + for (int c = 0; c < columns; c++) { + nodes.get(r).add(new Node()); + } + } + + outputs = new ArrayList<Output>(outputCount); + for (int o = 0; o < outputCount; o++) { + outputs.add(new Output()); + } + + } + + public int getActiveNodeCount() { + return 0; + } + + /** + * @return the inputs + */ + public final ArrayList<Input> getInputs() { + return inputs; + } + + /** + * @return the nodes + */ + public final ArrayList<ArrayList<Node>> getNodes() { + return nodes; + } + + /** + * @return the outputs + */ + public final ArrayList<Output> getOutputs() { + return outputs; + } + + public final Node getNode(int row, int column) { + return nodes.get(row).get(column); + } + + public final Output getOutput(int index) { + return outputs.get(index); + } + + public final Input getInputs(int index) { + return inputs.get(index); + } + + public int getFitness() { + return fitness; + } + + public void setFitness(int newFitness) { + fitness = newFitness; + } + +} |