diff --git a/.~lock.probleme_ouvert_voiture_elec.odt# b/.~lock.probleme_ouvert_voiture_elec.odt# deleted file mode 100644 index 37598f0..0000000 --- a/.~lock.probleme_ouvert_voiture_elec.odt# +++ /dev/null @@ -1 +0,0 @@ -,bezza,insa-10821,20.05.2025 11:05,file:///home/bezza/.config/libreoffice/4; \ No newline at end of file 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 110c233..c663726 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 @@ -78,13 +78,11 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm { if (newCost < succLabel.getCoutRealise()) { if (succLabel.getCoutRealise() != Double.POSITIVE_INFINITY) { heap.remove(succLabel); - //System.out.println(succLabel.getTotalCost());// print de confirmation , pour verif si tous les couts qui sortent du tas sont croissant. getTotalcost pas croissant!! + } succLabel.setCoutRealise(newCost); succLabel.setPere(arc); predecessorArcs[succ.getId()] = arc; - - // Insertion dans le tas car on est sûr qu'il n'est pas heap.insert(succLabel); diff --git a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/LabelStar.java b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/LabelStar.java index 88a9240..f72ebf9 100644 --- a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/LabelStar.java +++ b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/LabelStar.java @@ -19,27 +19,13 @@ public class LabelStar extends Label { //pour optimiser l'algo : ATTENTION PAS à L'initialisation pas le faire sinon ça va le faire pr tout les pts //on rajoute un paremètre distance ds le label et quand on passe sur le label si c'est linfini on le calcule - /*@Override - public double getTotalCost() { //pourquoi getTotalCost ? psq il est utilisé dans le compareTo - //System.out.println("cout realise : " + getCoutRealise()+ "\n distance : "distance(getSommetCourant().getPoint(),this.destination.getPoint())); - double cout=getCoutRealise(); - Point calcul = this.pathData.getDestination().getPoint(); - cout+=calcul.distanceTo(this.getSommetCourant().getPoint()); - return (cout); - }*/ - - //pas nécessaire normalement - /*public int compareTo(LabelStar other) { - return Double.compare(this.getTotalCost(), other.getTotalCost()); - }*/ /** * Calcule le coût total estimé (f = g + h) pour l'algorithme A*. * g (getCoutRealise()) est le coût actuel depuis le départ. - * h est l'heuristique : - * - En mode DISTANCE: distance à vol d'oiseau (via distanceTo) jusqu'à la destination. - * - En mode TEMPS: distance à vol d'oiseau (via distanceTo) / vitesse maximale sur le graphe. - * @return Le coût total estimé. + * h est : + * - En mode DISTANCE: distance à vol d'oiseau + * - En mode TEMPS: distance à vol d'oiseau / vitesse maximale sur le graphe. */ @Override public double getTotalCost() { @@ -51,7 +37,7 @@ public class LabelStar extends Label { Point currentPoint = current.getPoint(); Point destinationPoint = destinationNode.getPoint(); if (currentPoint == null || destinationPoint == null) { - return gCost; // Heuristique nulle si points non valides + return gCost; // si point null => on retourne juste le coût } //calcul vol d'oiseau @@ -66,7 +52,6 @@ public class LabelStar extends Label { hCost = distanceToDestinationMeters / maxSpeedMpS; // hCost est maintenant en secondes } else { - // Heuristique pour le mode DISTANCE (ou par défaut) hCost = distanceToDestinationMeters; // hCost est en mètres } diff --git a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/ProblemeOuvert.java b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/ProblemeOuvert.java index c0e44ac..162c4c3 100644 --- a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/ProblemeOuvert.java +++ b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/ProblemeOuvert.java @@ -81,19 +81,7 @@ Autres types de voies Aux nœuds d'autoroute, on offre la possibilité de "recharger", ce qui crée une nouvelle option (un nouveau label avec batterie pleine et coût de recharge ajouté) pour ce même nœud, à insérer dans le tas. - labels[data.getOrigin().getId()] = new LabelBattery(data.getOrigin(), false, 0, null, MAX_AUTONOMY); pour l'initialisation - - //permet de savoir si un node est un noeud d'autoroute - private boolean isHighwayNode(Node node) { - // Un nœud est sur une autoroute si au moins un de ses arcs entrants ou sortants est une autoroute. - // RoadType est accessible via arc.getRoadInfo().getType() - for (Arc arc : node.getSuccessors()) { - if (arc.getRoadInfo().getType().equals(RoadType.MOTORWAY)) { - return true; - } - } - return false; } normalement juste faut faire le verif de newcost avec l'autonomie @@ -158,13 +146,6 @@ public class ProblemeOuvert extends DijkstraAlgorithm { }*/ - /*@Override - protected void fonctionProblemeOuvert(RoadType typeDeRoute,LabelProblemeOuvert[] labels, BinaryHeap heap, Node node, - double newCost, Arc pere){ - if (typeDeRoute == RoadType.MOTORWAY) { - tryUpdateLabel(labels, heap,node, newCost, MAX_BATTERY, pere); - } - }*/ @Override diff --git a/problemeOuvert.odt b/problemeOuvert.odt new file mode 100644 index 0000000..82c39e3 Binary files /dev/null and b/problemeOuvert.odt differ