Dijkstra fonctionnel validé avec le prof+il manquera à implémenter LabelStar et Astar
This commit is contained in:
parent
8035821299
commit
cad511386b
3 changed files with 20 additions and 4 deletions
|
|
@ -61,14 +61,17 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
||||||
if (nouveauCout < labelSucc.getCoutRealise()) {
|
if (nouveauCout < labelSucc.getCoutRealise()) {
|
||||||
boolean dejaDansTas = Double.isFinite(labelSucc.getCoutRealise());
|
boolean dejaDansTas = Double.isFinite(labelSucc.getCoutRealise());
|
||||||
|
|
||||||
labelSucc.setCoutRealise(nouveauCout);
|
|
||||||
labelSucc.setPere(arc);
|
|
||||||
|
|
||||||
if (dejaDansTas) {
|
if (dejaDansTas) {
|
||||||
tas.remove(labelSucc);
|
tas.remove(labelSucc);
|
||||||
} else {
|
} else {
|
||||||
notifyNodeReached(arc.getDestination());
|
notifyNodeReached(arc.getDestination());
|
||||||
}
|
}
|
||||||
|
labelSucc.setCoutRealise(nouveauCout);
|
||||||
|
labelSucc.setPere(arc);
|
||||||
|
|
||||||
|
|
||||||
tas.insert(labelSucc);
|
tas.insert(labelSucc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ public class Label implements Comparable<Label>{
|
||||||
public Label(Node sommetCourant) {
|
public Label(Node sommetCourant) {
|
||||||
this.sommetCourant=sommetCourant;
|
this.sommetCourant=sommetCourant;
|
||||||
this.marque=false;
|
this.marque=false;
|
||||||
this.coutRealise=Double.POSITIVE_INFINITY ;
|
|
||||||
|
this.coutRealise=Double.POSITIVE_INFINITY;
|
||||||
this.pere=null;
|
this.pere=null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
//import org.insa.graphs.model.Arc;
|
||||||
|
//import org.insa.graphs.model.Node;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//package org.insa.graphs.algorithm.shortestpath;
|
||||||
|
|
||||||
|
//import org.insa.graphs.model.Arc;
|
||||||
|
|
||||||
|
//blic class LabelStar extends Label
|
||||||
|
//ublic LabelStar()
|
||||||
|
|
||||||
Loading…
Reference in a new issue