Dijkstra et A* corrigé2.1
This commit is contained in:
parent
5d45a5dc02
commit
4e07fd986e
2 changed files with 5 additions and 8 deletions
|
@ -56,7 +56,7 @@ public class AStarAlgorithm extends DijkstraAlgorithm {
|
|||
|
||||
maxSpeed = graph.getGraphInformation().getMaximumSpeed()/3.6;
|
||||
|
||||
System.out.println(maxSpeed);
|
||||
//System.out.println(maxSpeed);
|
||||
|
||||
for(Node node : graph.getNodes()){
|
||||
nodeId = node.getId();
|
||||
|
@ -67,7 +67,7 @@ public class AStarAlgorithm extends DijkstraAlgorithm {
|
|||
|
||||
else{ // Mode TEMPS sans vitesse max
|
||||
|
||||
System.err.println("uh");
|
||||
//System.err.println("uh");
|
||||
|
||||
for(Node node : graph.getNodes())
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class AStarAlgorithm extends DijkstraAlgorithm {
|
|||
|
||||
IdxNewOrigin = minHeap.deleteMin().currentNode.getId();
|
||||
labels[IdxNewOrigin].mark = true;
|
||||
notifyNodeMarked(labels[IdxNewOrigin].currentNode);
|
||||
//notifyNodeMarked(labels[IdxNewOrigin].currentNode);
|
||||
|
||||
for (Arc arc : labels[IdxNewOrigin].currentNode.getSuccessors()) { // le arrayList de getSucessors, ça ne retourne que des arc forward. donc pas besoin de vérifier qui est l'origine o`u la destination
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
|||
@Override
|
||||
protected ShortestPathSolution doRun() {
|
||||
|
||||
|
||||
|
||||
// retrieve data from the input problem (getInputData() is inherited from the
|
||||
// parent class ShortestPathAlgorithm)
|
||||
final ShortestPathData data = getInputData();
|
||||
|
@ -66,7 +64,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
|||
IdxNewOrigin = minHeap.deleteMin().currentNode.getId();
|
||||
labels[IdxNewOrigin].mark = true;
|
||||
|
||||
notifyNodeMarked(labels[IdxNewOrigin].currentNode);
|
||||
//notifyNodeMarked(labels[IdxNewOrigin].currentNode);
|
||||
|
||||
for (Arc arc : labels[IdxNewOrigin].currentNode.getSuccessors()) { // le arrayList de getSucessors, ça ne retourne que des arc forward. donc pas besoin de vérifier si le chemin est empruntable
|
||||
|
||||
|
@ -80,8 +78,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
|||
NewCost = labels[IdxNewOrigin].computedCost + data.getCost(arc); // calcul de la nouvelle distance
|
||||
OldCost = labels[arc.getDestination().getId()].computedCost; // lecture de l'ancienne
|
||||
|
||||
if (Double.isInfinite(OldCost)
|
||||
&& Double.isFinite(NewCost)) {
|
||||
if (Double.isInfinite(OldCost) && Double.isFinite(NewCost)) {
|
||||
notifyNodeReached(arc.getDestination());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue