Ajout test Solving Time
This commit is contained in:
parent
e41e12d980
commit
268ed91e85
3 changed files with 18 additions and 0 deletions
|
@ -89,6 +89,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
||||||
//On récupère le chemin (liste d'arcs) de la destination vers la source
|
//On récupère le chemin (liste d'arcs) de la destination vers la source
|
||||||
Label dest =List_Label.get(data.getDestination().getId());
|
Label dest =List_Label.get(data.getDestination().getId());
|
||||||
|
|
||||||
|
//Si on n'a pas de parent ou que la destination = origin on renvoie une solution avec status() infaisable
|
||||||
if (dest.getParent() == null || data.getOrigin()==data.getDestination()) {
|
if (dest.getParent() == null || data.getOrigin()==data.getDestination()) {
|
||||||
return solution = new ShortestPathSolution(data, Status.INFEASIBLE);
|
return solution = new ShortestPathSolution(data, Status.INFEASIBLE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,23 @@ public class DijkstraAlgorithmTest {
|
||||||
assertEquals(solution.getStatus(),soluce_Bellma.getStatus());
|
assertEquals(solution.getStatus(),soluce_Bellma.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void Comparaison_Solving_Time() throws IOException{
|
||||||
|
final String map_c = "/mnt/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Maps/carre-dense.mapgr";
|
||||||
|
final GraphReader reader = new BinaryGraphReader(new DataInputStream(new BufferedInputStream(new FileInputStream(map_c))));
|
||||||
|
Graph graph_c = reader.read();
|
||||||
|
ShortestPathData data = new ShortestPathData(graph_c,graph_c.get(120084),graph_c.get(191086),ArcInspectorFactory.getAllFilters().get(0));
|
||||||
|
ShortestPathAlgorithm Dijkstra =new DijkstraAlgorithm(data);
|
||||||
|
ShortestPathAlgorithm A_star= new AStarAlgorithm(data);
|
||||||
|
ShortestPathSolution soluce_Dijkstra= Dijkstra.run();
|
||||||
|
ShortestPathSolution soluce_Astar= A_star.run();
|
||||||
|
boolean result = false;
|
||||||
|
if (soluce_Dijkstra.getSolvingTime().toSeconds() > soluce_Astar.getSolvingTime().toSeconds()){
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
assertTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void Carte_Length() throws IOException{
|
public void Carte_Length() throws IOException{
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue