|
@@ -43,6 +43,8 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
43
|
43
|
double old_cost = 0 ; // on utilisera cette variable pour vérifier si le coût est croissant
|
44
|
44
|
|
45
|
45
|
int nbMarque = 0; // correspond au nombre de sommet marqué
|
|
46
|
+ int explorer = 0 ; // correspond au nombre de sommet exploré
|
|
47
|
+
|
46
|
48
|
while(!TabLabel[data.getDestination().getId()].isMarque() ) { // tant que la destination est non marqués
|
47
|
49
|
Node X ;
|
48
|
50
|
try {
|
|
@@ -73,6 +75,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
73
|
75
|
Tas.insert(TabLabel[Y.getId()]);
|
74
|
76
|
TabLabel[Y.getId()].setFather(a);
|
75
|
77
|
this.notifyNodeReached(Y);
|
|
78
|
+ explorer ++ ;
|
76
|
79
|
}
|
77
|
80
|
else if(TabLabel[Y.getId()].getCost() > TabLabel[X.getId()].getCost()+ data.getCost(a)) {
|
78
|
81
|
TabLabel[Y.getId()].setCost( TabLabel[X.getId()].getCost()+ data.getCost(a) );
|
|
@@ -85,7 +88,8 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
85
|
88
|
}
|
86
|
89
|
}
|
87
|
90
|
}
|
88
|
|
-
|
|
91
|
+ long fin = System.nanoTime(); // pour le temps d'execution
|
|
92
|
+
|
89
|
93
|
// Create the path from the array of predecessors...
|
90
|
94
|
ArrayList<Arc> arcs = new ArrayList<>();
|
91
|
95
|
|
|
@@ -134,6 +138,8 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
134
|
138
|
|
135
|
139
|
|
136
|
140
|
System.out.println("Nb iterations: " + nbMarque + ", Nb arcs du PCC: " + arcs.size());
|
|
141
|
+ System.out.println("Nb de sommets explorés : " + explorer);
|
|
142
|
+
|
137
|
143
|
return solution;
|
138
|
144
|
|
139
|
145
|
}
|