From db7919be94a11bca3f93ba1fbf5cd3fd6b8d02e5 Mon Sep 17 00:00:00 2001 From: Nabil Ould Hamou Date: Fri, 11 Oct 2024 20:11:19 +0200 Subject: [PATCH] feur --- .../java/fr/nabil/algogenetique/Main.java | 2 + .../fr/nabil/algogenetique/logique/Maze.java | 69 +++++++++++++++++++ .../algogenetique/logique/Population.java | 13 ++++ .../algogenetique/logique/Simulation.java | 7 ++ 4 files changed, 91 insertions(+) create mode 100644 src/main/java/fr/nabil/algogenetique/logique/Maze.java create mode 100644 src/main/java/fr/nabil/algogenetique/logique/Simulation.java diff --git a/src/main/java/fr/nabil/algogenetique/Main.java b/src/main/java/fr/nabil/algogenetique/Main.java index 743234a..6f422f0 100644 --- a/src/main/java/fr/nabil/algogenetique/Main.java +++ b/src/main/java/fr/nabil/algogenetique/Main.java @@ -4,6 +4,8 @@ public class Main { public static void main(String[] args) { + + } } diff --git a/src/main/java/fr/nabil/algogenetique/logique/Maze.java b/src/main/java/fr/nabil/algogenetique/logique/Maze.java new file mode 100644 index 0000000..6f597ed --- /dev/null +++ b/src/main/java/fr/nabil/algogenetique/logique/Maze.java @@ -0,0 +1,69 @@ +package fr.nabil.algogenetique.logique; + +public class Maze implements Simulation { + + private int[][] maze = { + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1}, + + }; + + private int populationSize; + private int iterations; + + private float mutation; + private float crossover; + private float elitism; + + public Maze(int populationSize, int iterations, float mutation, float crossover, float elitism) { + this.populationSize = populationSize; + this.iterations = iterations; + this.mutation = mutation; + this.crossover = crossover; + this.elitism = elitism; + } + + public void evaluate() { + + } + + public int getPopulationSize() { + return populationSize; + } + + public void setPopulationSize(int populationSize) { + this.populationSize = populationSize; + } + + public int getIterations() { + return iterations; + } + + public void setIterations(int iterations) { + this.iterations = iterations; + } + + public float getMutation() { + return mutation; + } + + public void setMutation(float mutation) { + this.mutation = mutation; + } + + public float getCrossover() { + return crossover; + } + + public void setCrossover(float crossover) { + this.crossover = crossover; + } + + public float getElitism() { + return elitism; + } + + public void setElitism(float elitism) { + this.elitism = elitism; + } +} diff --git a/src/main/java/fr/nabil/algogenetique/logique/Population.java b/src/main/java/fr/nabil/algogenetique/logique/Population.java index 7f0db94..981bd64 100644 --- a/src/main/java/fr/nabil/algogenetique/logique/Population.java +++ b/src/main/java/fr/nabil/algogenetique/logique/Population.java @@ -6,6 +6,19 @@ public class Population { private BitSet chromosome; + public Population() { + this.chromosome = new BitSet(); + } + public Population(BitSet chromosome) { + this.chromosome = chromosome; + } + public BitSet getChromosome() { + return chromosome; + } + + public void setChromosome(BitSet chromosome) { + this.chromosome = chromosome; + } } diff --git a/src/main/java/fr/nabil/algogenetique/logique/Simulation.java b/src/main/java/fr/nabil/algogenetique/logique/Simulation.java new file mode 100644 index 0000000..4b7e708 --- /dev/null +++ b/src/main/java/fr/nabil/algogenetique/logique/Simulation.java @@ -0,0 +1,7 @@ +package fr.nabil.algogenetique.logique; + +public interface Simulation { + + void evaluate(); + +}