Tests pass: 11 minutes
This commit is contained in:
parent
3095e3e08c
commit
3f7a1543fd
1 changed files with 22 additions and 10 deletions
|
@ -162,7 +162,7 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
* -un plus court chemin de coût inférieur au chemin (premier dijkstra) dont il a été extrait.
|
||||
* On teste 'nbrePCC' PCC et 'nbreSousPCC' sous PCC.
|
||||
*/
|
||||
public void TestsCheminsTropLongs(Graph graph, Node origin, Node destination, ArcInspector arcFilter, int nbrePCC, int nbreSousPCC, float tolerance) {
|
||||
public void TestsCheminsTropLongs(Graph graph, Node origin, Node destination, ArcInspector arcFilter, int nbrePCC, int nbreSousPCC) {
|
||||
int longueur_path = 0;
|
||||
Node noeudSelectionneOrigine = graph.get(0);
|
||||
Node noeudSelectionneDestination = graph.get(0);
|
||||
|
@ -180,9 +180,16 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
if (path.getPath() != null) {
|
||||
assert(path.getPath().isValid());
|
||||
assert(path.isFeasible());
|
||||
assert((Math.abs(algo.getCostPath() - path.getPath().getLength())) < tolerance);
|
||||
double distanceFromOriginToDestination = 0;
|
||||
if (data.getMode() == Mode.LENGTH) {
|
||||
assert((Math.abs(algo.getCostPath() - path.getPath().getLength())) < 1);
|
||||
distanceFromOriginToDestination = Point.distance(origin.getPoint(), destination.getPoint());
|
||||
}
|
||||
else {
|
||||
assert((Math.abs(algo.getCostPath() - path.getPath().getMinimumTravelTime())) < 1);
|
||||
distanceFromOriginToDestination = Point.distance(origin.getPoint(), destination.getPoint()) / (1000 * graph.getGraphInformation().getMaximumSpeed());
|
||||
}
|
||||
|
||||
double distanceFromOriginToDestination = Point.distance(origin.getPoint(), destination.getPoint());
|
||||
|
||||
// Distance trouvée supérieure ou égale (improbable voire impossible) au chemin à vol d'oiseau.
|
||||
assert(distanceFromOriginToDestination <= algo.getCostPath());
|
||||
|
@ -212,7 +219,12 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
}
|
||||
assert(pathSousPCC.getPath().isValid());
|
||||
assert(pathSousPCC.isFeasible());
|
||||
assert((Math.abs(algoSousPCC.getCostPath() - pathSousPCC.getPath().getLength())) < 1.0);
|
||||
if (data.getMode() == Mode.LENGTH) {
|
||||
assert((Math.abs(algoSousPCC.getCostPath() - pathSousPCC.getPath().getLength())) < 1.0);
|
||||
}
|
||||
else {
|
||||
assert((Math.abs(algoSousPCC.getCostPath() - pathSousPCC.getPath().getMinimumTravelTime())) < 1.0);
|
||||
}
|
||||
|
||||
// sous PCC de coût inférieur au PCC
|
||||
assert(algoSousPCC.getCostPath() <= algo.getCostPath());
|
||||
|
@ -348,7 +360,7 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
nTestsWithBellman(myGraph, origin, destination, arcInspector, size_graph, 100);
|
||||
}
|
||||
|
||||
//@Test
|
||||
@Test
|
||||
/*
|
||||
* Permet de tester les chemins moyennement longs en temps (0 - 2h).
|
||||
* On teste 100 chemins sur la carte de Toulouse (environ 1 min d'exécution)
|
||||
|
@ -445,10 +457,10 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
Node origin = myGraph.get(0);
|
||||
Node destination = myGraph.get(0);
|
||||
|
||||
TestsCheminsTropLongs(myGraph, origin, destination, arcInspector, 10, 25, 1);
|
||||
TestsCheminsTropLongs(myGraph, origin, destination, arcInspector, 10, 25);
|
||||
}
|
||||
|
||||
// @Test
|
||||
@Test
|
||||
/*
|
||||
* Le principe du test est celui utilisé dans la méthode TestsCheminsTropLongues:
|
||||
* -On fait plusieurs PCC et pour chacun on extrait plusieurs chemins des PCC
|
||||
|
@ -468,7 +480,7 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
Node origin = myGraph.get(0);
|
||||
Node destination = myGraph.get(0);
|
||||
|
||||
TestsCheminsTropLongs(myGraph, origin, destination, arcInspector, 10, 25, 1);
|
||||
TestsCheminsTropLongs(myGraph, origin, destination, arcInspector, 10, 25);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -491,7 +503,7 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
Node origin = myGraph.get(0);
|
||||
Node destination = myGraph.get(0);
|
||||
|
||||
TestsCheminsTropLongs(myGraph, origin, destination, arcInspector, 1, 10, 10);
|
||||
TestsCheminsTropLongs(myGraph, origin, destination, arcInspector, 10, 25);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -514,7 +526,7 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
Node origin = myGraph.get(0);
|
||||
Node destination = myGraph.get(0);
|
||||
|
||||
TestsCheminsTropLongs(myGraph, origin, destination, arcInspector, 1, 10, 10);
|
||||
TestsCheminsTropLongs(myGraph, origin, destination, arcInspector, 10, 25);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue