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()) {
|
||||
boolean dejaDansTas = Double.isFinite(labelSucc.getCoutRealise());
|
||||
|
||||
labelSucc.setCoutRealise(nouveauCout);
|
||||
labelSucc.setPere(arc);
|
||||
|
||||
|
||||
if (dejaDansTas) {
|
||||
tas.remove(labelSucc);
|
||||
} else {
|
||||
notifyNodeReached(arc.getDestination());
|
||||
}
|
||||
labelSucc.setCoutRealise(nouveauCout);
|
||||
labelSucc.setPere(arc);
|
||||
|
||||
|
||||
tas.insert(labelSucc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ public class Label implements Comparable<Label>{
|
|||
public Label(Node sommetCourant) {
|
||||
this.sommetCourant=sommetCourant;
|
||||
this.marque=false;
|
||||
this.coutRealise=Double.POSITIVE_INFINITY ;
|
||||
|
||||
this.coutRealise=Double.POSITIVE_INFINITY;
|
||||
this.pere=null;
|
||||
|
||||
}
|
||||
|
|
@ -53,4 +54,4 @@ public int compareTo(Label other){
|
|||
return Double.compare(this.getCost(), other.getCost());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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