dijkstra verifications OK
This commit is contained in:
parent
df55fb1472
commit
b45ff5d930
1 changed files with 36 additions and 36 deletions
|
@ -60,7 +60,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
||||||
x = tas.deleteMin();
|
x = tas.deleteMin();
|
||||||
x.mark();
|
x.mark();
|
||||||
notifyNodeMarked(x.getNode());
|
notifyNodeMarked(x.getNode());
|
||||||
|
// System.out.println(x.getCost()); // Pour vérifier une croissance des noeuds marqués
|
||||||
// We create a list of node successors of x, instead of a list of Arcs.
|
// We create a list of node successors of x, instead of a list of Arcs.
|
||||||
float arc_cost = 0;
|
float arc_cost = 0;
|
||||||
for (Arc successorArc : x.getNode().getSuccessors()) {
|
for (Arc successorArc : x.getNode().getSuccessors()) {
|
||||||
|
@ -96,7 +96,10 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (labels.get(data.getDestination().getId()).getParentNode() == null) {
|
||||||
|
solution = new ShortestPathSolution(data, Status.INFEASIBLE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
// Create the path ...
|
// Create the path ...
|
||||||
ArrayList<Arc> arcs_path = new ArrayList<>();
|
ArrayList<Arc> arcs_path = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -132,11 +135,8 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
||||||
|
|
||||||
// Create the final solution.
|
// Create the final solution.
|
||||||
solution = new ShortestPathSolution(data, Status.OPTIMAL, new Path(graph, arcs_path));
|
solution = new ShortestPathSolution(data, Status.OPTIMAL, new Path(graph, arcs_path));
|
||||||
|
}
|
||||||
|
|
||||||
/*System.out.println("watch here" + "\n");
|
|
||||||
for (Arc a : arcs_path){
|
|
||||||
System.out.println(a.getOrigin().getId() + " --- " + a.getDestination().getId() + "\n");
|
|
||||||
}*/
|
|
||||||
return solution;
|
return solution;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue