Dernieres modifications

這個提交存在於:
Auriane Lartigue 2020-06-01 18:17:28 +02:00
父節點 0484234692
當前提交 03d1d8f729
共有 2 個檔案被更改,包括 9 行新增3 行删除

查看文件

@ -43,6 +43,8 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
double old_cost = 0 ; // on utilisera cette variable pour vérifier si le coût est croissant
int nbMarque = 0; // correspond au nombre de sommet marqué
int explorer = 0 ; // correspond au nombre de sommet exploré
while(!TabLabel[data.getDestination().getId()].isMarque() ) { // tant que la destination est non marqués
Node X ;
try {
@ -73,6 +75,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
Tas.insert(TabLabel[Y.getId()]);
TabLabel[Y.getId()].setFather(a);
this.notifyNodeReached(Y);
explorer ++ ;
}
else if(TabLabel[Y.getId()].getCost() > TabLabel[X.getId()].getCost()+ data.getCost(a)) {
TabLabel[Y.getId()].setCost( TabLabel[X.getId()].getCost()+ data.getCost(a) );
@ -85,6 +88,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
}
}
}
long fin = System.nanoTime(); // pour le temps d'execution
// Create the path from the array of predecessors...
ArrayList<Arc> arcs = new ArrayList<>();
@ -134,6 +138,8 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
System.out.println("Nb iterations: " + nbMarque + ", Nb arcs du PCC: " + arcs.size());
System.out.println("Nb de sommets explorés : " + explorer);
return solution;
}

查看文件

@ -96,7 +96,7 @@ public class ComparerAlgoTest {
Assume.assumeTrue(parameters.getOrigin() == parameters.getDestination() && parameters.getGraph().getMapName() != graph2.getMapName());
ShortestPathAlgorithm DA = new DijkstraAlgorithm(parameters);
ShortestPathAlgorithm BF = new BellmanFordAlgorithm(parameters);
assertEquals( DA.run().getPath() , BF.run().getPath());
assertEquals( DA.run().getStatus() , BF.run().getStatus());
}
// -----------------------------DijkstraNormalPathSP-------------------------------------
@ -117,7 +117,7 @@ public class ComparerAlgoTest {
Assume.assumeTrue(parameters.getOrigin() == parameters.getDestination() && parameters.getGraph().getMapName() != graph2.getMapName());
AStarAlgorithm AS = new AStarAlgorithm(parameters);
ShortestPathAlgorithm BF = new BellmanFordAlgorithm(parameters);
assertEquals( AS.run().getPath() , BF.run().getPath());
assertEquals( AS.run().getStatus() , BF.run().getStatus());
}
// ----------------------------------AStarNormalPathSP-------------------------------------