From c38b7448c76cee755061b1deea7a38f217656724 Mon Sep 17 00:00:00 2001 From: Gasson-Betuing Danyl Date: Tue, 20 May 2025 10:24:41 +0200 Subject: [PATCH] =?UTF-8?q?Dijkstra=20et=20A*=20corrig=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/insa/graphs/algorithm/shortestpath/AStarAlgorithm.java | 2 +- .../insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java | 2 +- 2 files changed, 2 insertions(+), 2 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 6e6083c..06d49bb 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 @@ -81,7 +81,7 @@ public class AStarAlgorithm extends DijkstraAlgorithm { OldDist = labels[arc.getDestination().getId()].computedCost; EstimatedCost = labels[arc.getDestination().getId()].destCost; - NewDist = labels[IdxNewOrigin].computedCost + arc.getLength(); // calcul de la nouvelle distance + NewDist = labels[IdxNewOrigin].computedCost + data.getCost(arc); // calcul de la nouvelle distance/temps // to observe the path search diff --git a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java index 1073543..71fa59b 100644 --- a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java +++ b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java @@ -71,7 +71,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm { if (!labels[arc.getDestination().getId()].mark){ // verif du marquage - NewDist = labels[IdxNewOrigin].computedCost + arc.getLength(); // calcul de la nouvelle distance + NewDist = labels[IdxNewOrigin].computedCost + data.getCost(arc); // calcul de la nouvelle distance OldDist = labels[arc.getDestination().getId()].computedCost; // lecture de l'ancienne if (Double.isInfinite(OldDist)