From a68e27f24df96b7bf1a791232c4519133b89c1b2 Mon Sep 17 00:00:00 2001 From: Pellerin Tiphaine Date: Thu, 28 May 2026 17:37:06 +0200 Subject: [PATCH] factorisation de label, labelstar, dijkstra et astar --- .../shortestpath/AStarAlgorithm.java | 101 +----------------- .../shortestpath/DijkstraAlgorithm.java | 72 ++++++------- .../graphs/algorithm/shortestpath/Label.java | 50 +++++---- .../algorithm/shortestpath/LabelStar.java | 22 ++-- .../shortestpath/AStarAlgorithm.class | Bin 5602 -> 1381 bytes .../shortestpath/DijkstraAlgorithm.class | Bin 5428 -> 5300 bytes .../graphs/algorithm/shortestpath/Label.class | Bin 1528 -> 1742 bytes .../algorithm/shortestpath/LabelStar.class | Bin 1062 -> 1067 bytes .../main/java/org/insa/graphs/model/Path.java | 6 -- .../classes/org/insa/graphs/model/Path.class | Bin 6412 -> 6412 bytes 10 files changed, 77 insertions(+), 174 deletions(-) diff --git a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/AStarAlgorithm.java b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/AStarAlgorithm.java index c659b75..b1f515a 100644 --- a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/AStarAlgorithm.java +++ b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/AStarAlgorithm.java @@ -1,14 +1,6 @@ package org.insa.graphs.algorithm.shortestpath; -import java.util.ArrayList; -import java.util.Collections; - -import org.insa.graphs.algorithm.AbstractSolution.Status; -import org.insa.graphs.algorithm.utils.BinaryHeap; -import org.insa.graphs.model.Arc; -import org.insa.graphs.model.Graph; import org.insa.graphs.model.Node; -import org.insa.graphs.model.Path; public class AStarAlgorithm extends DijkstraAlgorithm { @@ -16,94 +8,9 @@ public class AStarAlgorithm extends DijkstraAlgorithm { super(data); } - public LabelStar newLabelStar(Node s, ShortestPathData data){ - return new LabelStar(s, false, Integer.MAX_VALUE, null, s.getPoint().distanceTo(data.getDestination().getPoint())); - } - - @Override - public ShortestPathSolution doRun() { - - // retrieve data from the input problem (getInputData() is inherited from the - // parent class ShortestPathAlgorithm) - final ShortestPathData data = getInputData(); - Graph graph = data.getGraph(); - final int nbNodes = graph.size(); - // ArrayList