All validity tests
This commit is contained in:
parent
1e183cedf8
commit
45adcbeb8e
2 changed files with 367 additions and 300 deletions
|
@ -32,18 +32,23 @@ public class AStarAlgorithmTest extends ShortestPathAlgorithmTest {
|
||||||
final DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(data);
|
final DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(data);
|
||||||
final ShortestPathSolution dijkstra_path = dijkstra.doRun();
|
final ShortestPathSolution dijkstra_path = dijkstra.doRun();
|
||||||
|
|
||||||
assert(Astar_path.getPath().isValid());
|
if (dijkstra_path.getPath() != null) {
|
||||||
assert(Astar_path.isFeasible());
|
assert(Astar_path.getPath().isValid());
|
||||||
assert(dijkstra_path.getPath().isValid());
|
if (dijkstra_path.isFeasible()) {
|
||||||
assert(dijkstra_path.isFeasible());
|
assert(Astar_path.isFeasible());
|
||||||
|
if (data.getMode() == Mode.LENGTH) {
|
||||||
if (data.getMode() == Mode.LENGTH) {
|
assert(Math.abs(Astar.getCostPath() - Astar_path.getPath().getLength()) < 1.0);
|
||||||
assert(Math.abs(Astar.getCostPath() - Astar_path.getPath().getLength()) < 1.0);
|
assert(Math.abs(Astar_path.getPath().getLength() - dijkstra_path.getPath().getLength()) < 1.0);
|
||||||
assert(Math.abs(Astar_path.getPath().getLength() - dijkstra_path.getPath().getLength()) < 1.0);
|
}
|
||||||
|
else {
|
||||||
|
assert(Math.abs(Astar.getCostPath() - Astar_path.getPath().getMinimumTravelTime()) < 1.0);
|
||||||
|
assert(Math.abs(Astar_path.getPath().getMinimumTravelTime() - dijkstra_path.getPath().getMinimumTravelTime()) < 1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(Math.abs(Astar.getCostPath() - Astar_path.getPath().getMinimumTravelTime()) < 1.0);
|
assert(Astar_path.getPath() == null);
|
||||||
assert(Math.abs(Astar_path.getPath().getMinimumTravelTime() - dijkstra_path.getPath().getMinimumTravelTime()) < 1.0);
|
assert(!Astar_path.isFeasible());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,37 +56,47 @@ public class AStarAlgorithmTest extends ShortestPathAlgorithmTest {
|
||||||
/*
|
/*
|
||||||
* Test supplémentaire pour Astar: on va vérifier que les résultats obtenus
|
* Test supplémentaire pour Astar: on va vérifier que les résultats obtenus
|
||||||
* sont les mêmes que ceux obtenus avec Dijkstra.
|
* sont les mêmes que ceux obtenus avec Dijkstra.
|
||||||
* Origine: 16644
|
|
||||||
* Destination: 39229
|
|
||||||
* Mode: LENGTH
|
* Mode: LENGTH
|
||||||
* PATH UTILISE : ../Paths/custom_paths/long_path_tls.path
|
* Carte utilisée : ../Maps/toulouse.mapgr
|
||||||
*/
|
*/
|
||||||
public void Dijkstra_Astar_LENGTH() {
|
public void Dijkstra_Astar_LENGTH() {
|
||||||
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
|
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
|
||||||
Graph myGraph = graph.get(2);
|
Graph myGraph = graph.get(2);
|
||||||
Node origin = myGraph.get(16644);
|
|
||||||
Node destination = myGraph.get(39229);
|
|
||||||
|
|
||||||
assertDijkstraAStarHaveSameResult(myGraph, origin, destination, arcInspector);
|
Node origin = myGraph.get(0);
|
||||||
|
Node destination = myGraph.get(0);
|
||||||
|
|
||||||
|
int size_graph = myGraph.size();
|
||||||
|
|
||||||
|
for (int i = 0 ; i < 50 ; i++) {
|
||||||
|
origin = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
|
destination = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
|
|
||||||
|
assertDijkstraAStarHaveSameResult(myGraph, origin, destination, arcInspector);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
/*
|
/*
|
||||||
* Test supplémentaire pour Astar: on va vérifier que les résultats obtenus
|
* Test supplémentaire pour Astar: on va vérifier que les résultats obtenus
|
||||||
* sont les mêmes que ceux obtenus avec Dijkstra.
|
* sont les mêmes que ceux obtenus avec Dijkstra.
|
||||||
* Origine: 16644
|
|
||||||
* Destination: 39229
|
|
||||||
* Mode: TIME
|
* Mode: TIME
|
||||||
* PATH UTILISE : ../Paths/custom_paths/long_path_tls.path
|
* Carte utilisée : ../Maps/toulouse.mapgr
|
||||||
*/
|
*/
|
||||||
public void Dijkstra_Astar_TIME() {
|
public void Dijkstra_Astar_TIME() {
|
||||||
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(2);
|
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(2);
|
||||||
Graph myGraph = graph.get(2);
|
Graph myGraph = graph.get(2);
|
||||||
Node origin = myGraph.get(16644);
|
Node origin = myGraph.get(0);
|
||||||
Node destination = myGraph.get(39229);
|
Node destination = myGraph.get(0);
|
||||||
|
|
||||||
assertDijkstraAStarHaveSameResult(myGraph, origin, destination, arcInspector);
|
int size_graph = myGraph.size();
|
||||||
|
|
||||||
|
for (int i = 0 ; i < 50 ; i++) {
|
||||||
|
origin = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
|
destination = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
|
|
||||||
|
assertDijkstraAStarHaveSameResult(myGraph, origin, destination, arcInspector);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,17 +11,21 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import javax.print.attribute.standard.Destination;
|
||||||
|
|
||||||
import org.insa.graphs.algorithm.AbstractInputData.Mode;
|
import org.insa.graphs.algorithm.AbstractInputData.Mode;
|
||||||
import org.insa.graphs.algorithm.ArcInspector;
|
import org.insa.graphs.algorithm.ArcInspector;
|
||||||
import org.insa.graphs.algorithm.ArcInspectorFactory;
|
import org.insa.graphs.algorithm.ArcInspectorFactory;
|
||||||
import org.insa.graphs.model.Graph;
|
import org.insa.graphs.model.Graph;
|
||||||
import org.insa.graphs.model.Node;
|
import org.insa.graphs.model.Node;
|
||||||
import org.insa.graphs.model.Path;
|
import org.insa.graphs.model.Path;
|
||||||
|
import org.insa.graphs.model.Point;
|
||||||
import org.insa.graphs.model.io.BinaryGraphReader;
|
import org.insa.graphs.model.io.BinaryGraphReader;
|
||||||
import org.insa.graphs.model.io.GraphReader;
|
import org.insa.graphs.model.io.GraphReader;
|
||||||
import org.insa.graphs.model.io.PathReader;
|
import org.insa.graphs.model.io.PathReader;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.Description;
|
||||||
import org.junit.runners.Parameterized.Parameter;
|
import org.junit.runners.Parameterized.Parameter;
|
||||||
|
|
||||||
public abstract class ShortestPathAlgorithmTest {
|
public abstract class ShortestPathAlgorithmTest {
|
||||||
|
@ -30,6 +34,7 @@ public abstract class ShortestPathAlgorithmTest {
|
||||||
public static ArrayList<Graph> graph = new ArrayList<Graph>();
|
public static ArrayList<Graph> graph = new ArrayList<Graph>();
|
||||||
public static PathReader pathReader;
|
public static PathReader pathReader;
|
||||||
public static ArrayList<Path> path = new ArrayList<Path>();
|
public static ArrayList<Path> path = new ArrayList<Path>();
|
||||||
|
public static Random rand = new Random();
|
||||||
|
|
||||||
protected abstract ShortestPathAlgorithm initAlgo(ShortestPathData data);
|
protected abstract ShortestPathAlgorithm initAlgo(ShortestPathData data);
|
||||||
|
|
||||||
|
@ -91,29 +96,48 @@ public abstract class ShortestPathAlgorithmTest {
|
||||||
final BellmanFordAlgorithm bellman = new BellmanFordAlgorithm(data);
|
final BellmanFordAlgorithm bellman = new BellmanFordAlgorithm(data);
|
||||||
final ShortestPathSolution bell_path = bellman.doRun();
|
final ShortestPathSolution bell_path = bellman.doRun();
|
||||||
|
|
||||||
|
|
||||||
if (bell_path.getPath() != null) {
|
if (bell_path.getPath() != null) {
|
||||||
if (bell_path.getPath().isValid()) {
|
assert(path.getPath().isValid());
|
||||||
assert(path.getPath().isValid());
|
if (bell_path.isFeasible()) {
|
||||||
assert(path.isFeasible());
|
assert(path.isFeasible());
|
||||||
if (data.getMode() == Mode.LENGTH) {
|
if (data.getMode() == Mode.LENGTH) {
|
||||||
assert(Math.abs((float) algo.getCostPath() - path.getPath().getLength()) < 0.1);
|
assert(Math.abs((float) algo.getCostPath() - path.getPath().getLength()) < 1);
|
||||||
assert(Math.abs(path.getPath().getLength() - bell_path.getPath().getLength()) < 0.1);
|
assert(Math.abs(path.getPath().getLength() - bell_path.getPath().getLength()) < 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(Math.abs(algo.getCostPath() - path.getPath().getMinimumTravelTime()) < 0.1);
|
if (!(arcFilter == ArcInspectorFactory.getAllFilters().get(4))) {
|
||||||
assert(Math.abs(path.getPath().getMinimumTravelTime() - bell_path.getPath().getMinimumTravelTime()) < 0.1);
|
assert(Math.abs(algo.getCostPath() - path.getPath().getMinimumTravelTime()) < 1);
|
||||||
|
}
|
||||||
|
assert(Math.abs(path.getPath().getMinimumTravelTime() - bell_path.getPath().getMinimumTravelTime()) < 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(!path.getPath().isValid());
|
|
||||||
assert(!path.isFeasible());
|
assert(!path.isFeasible());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
assert(path.getPath() == null);
|
||||||
assert(!path.isFeasible());
|
assert(!path.isFeasible());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Realizes n tests with the given graph informations.
|
||||||
|
* The n tests all use random origin and destination nodes id.
|
||||||
|
* The outputs of the tests are compared with the algorithm Bellman.
|
||||||
|
* This is why this function shall be used only for graphs of little size
|
||||||
|
* (in terms of nodes OR arcs as complexity of Bellman is : O(n*m)).
|
||||||
|
*/
|
||||||
|
private void nTestsWithBellman(Graph graph, Node origin, Node destination, ArcInspector arcFilter, int numberOfNodes, int numberOfTests) {
|
||||||
|
for (int i = 0 ; i < numberOfTests ; i++) {
|
||||||
|
origin = graph.get(Math.abs(rand.nextInt()) % numberOfNodes);
|
||||||
|
destination = graph.get(Math.abs(rand.nextInt()) % numberOfNodes);
|
||||||
|
|
||||||
|
assertBellmanHasSameResult(graph, origin, destination, arcFilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verifies that no path is found
|
* Verifies that no path is found
|
||||||
*/
|
*/
|
||||||
|
@ -126,40 +150,6 @@ public abstract class ShortestPathAlgorithmTest {
|
||||||
assert(!path.isFeasible());
|
assert(!path.isFeasible());
|
||||||
assert(path.getPath() == null);
|
assert(path.getPath() == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
/*
|
|
||||||
* Map: carre.mapgr
|
|
||||||
* Chemin: 19 --> 4
|
|
||||||
* Tous chemins permis
|
|
||||||
* Mode: LENGTH
|
|
||||||
* PATH UTILISE : ../Paths/custom_paths/short_path_carre.path
|
|
||||||
*/
|
|
||||||
public void chemin_court_CARRE_length() {
|
|
||||||
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0); // all arcs
|
|
||||||
Graph myGraph = graph.get(0);
|
|
||||||
|
|
||||||
Node origin = myGraph.get(19);
|
|
||||||
Node destination = myGraph.get(4);
|
|
||||||
|
|
||||||
assertBellmanHasSameResult(myGraph, origin, destination, arcInspector);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
/*
|
|
||||||
* Chemin long relativement à la carte carrée.
|
|
||||||
* Chemin: 15 --> 9
|
|
||||||
* Tous chemins permis
|
|
||||||
* PATH UTILISE : ../Paths/custom_paths/long_path_carre.path
|
|
||||||
*/
|
|
||||||
public void chemin_long_CARRE_length() {
|
|
||||||
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
|
|
||||||
Graph myGraph = graph.get(0);
|
|
||||||
Node origin = myGraph.get(15);
|
|
||||||
Node destination = myGraph.get(9);
|
|
||||||
|
|
||||||
assertBellmanHasSameResult(myGraph, origin, destination, arcInspector);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -171,8 +161,11 @@ public abstract class ShortestPathAlgorithmTest {
|
||||||
public void chemin_nul_CARRE() {
|
public void chemin_nul_CARRE() {
|
||||||
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
|
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
|
||||||
Graph myGraph = graph.get(0);
|
Graph myGraph = graph.get(0);
|
||||||
Node origin = myGraph.get(3);
|
|
||||||
Node destination = myGraph.get(3);
|
int indiceNoeud = Math.abs(rand.nextInt()) % myGraph.size();
|
||||||
|
|
||||||
|
Node origin = myGraph.get(indiceNoeud);
|
||||||
|
Node destination = myGraph.get(indiceNoeud);
|
||||||
|
|
||||||
assertNoPathFound(myGraph, origin, destination, arcInspector);
|
assertNoPathFound(myGraph, origin, destination, arcInspector);
|
||||||
}
|
}
|
||||||
|
@ -194,263 +187,322 @@ public abstract class ShortestPathAlgorithmTest {
|
||||||
assertNoPathFound(myGraph, origin, destination, arcInspector);
|
assertNoPathFound(myGraph, origin, destination, arcInspector);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
/*
|
|
||||||
* Chemin court sur la carte de Toulouse.
|
|
||||||
* Origine : 8423
|
|
||||||
* Destination: 8435
|
|
||||||
* Tous chemins permis.
|
|
||||||
* PATH UTILISE : ../Paths/custom_paths/short_path_tls.path
|
|
||||||
*/
|
|
||||||
public void chemin_court_TLS() {
|
|
||||||
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
|
|
||||||
Graph myGraph = graph.get(2);
|
|
||||||
Node origin = myGraph.get(8423);
|
|
||||||
Node destination = myGraph.get(8435);
|
|
||||||
|
|
||||||
assertBellmanHasSameResult(myGraph, origin, destination, arcInspector);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
/*
|
|
||||||
* Chemin long sur la carte de Toulouse.
|
|
||||||
* Même si Bellman est de plus long à faire long à faire, ce test prend moins
|
|
||||||
* de 3s, on estime que ce n'est pas trop et on va utiliser Bellman.
|
|
||||||
* Par contre, dans le test sur la région midi_pyrenees qui arrive après, on va
|
|
||||||
* être obligé de trouver une autre solution.
|
|
||||||
* Origine: 16644
|
|
||||||
* Destination: 39229
|
|
||||||
* Mode: LENGTH
|
|
||||||
* PATH UTILISE : ../Paths/custom_paths/long_path_tls.path
|
|
||||||
*/
|
|
||||||
public void chemin_long_TLS_length() {
|
|
||||||
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
|
|
||||||
Graph myGraph = graph.get(2);
|
|
||||||
Node origin = myGraph.get(16644);
|
|
||||||
Node destination = myGraph.get(39229);
|
|
||||||
|
|
||||||
assertBellmanHasSameResult(myGraph, origin, destination, arcInspector);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
/*
|
|
||||||
* Chemin long sur la carte de Toulouse.
|
|
||||||
* Même si Bellman est de plus long à faire long à faire, ce test prend moins
|
|
||||||
* de 3s, on estime que ce n'est pas trop et on va utiliser Bellman.
|
|
||||||
* Par contre, dans le test sur la région midi_pyrenees qui arrive après, on va
|
|
||||||
* être obligé de trouver une autre solution.
|
|
||||||
* Origine: 16644
|
|
||||||
* Destination: 39229
|
|
||||||
* Mode: TIME
|
|
||||||
* PATH UTILISE : ../Paths/custom_paths/long_path_tls.path
|
|
||||||
*/
|
|
||||||
public void chemin_long_TLS_time() {
|
|
||||||
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(2);
|
|
||||||
Graph myGraph = graph.get(2);
|
|
||||||
Node origin = myGraph.get(16644);
|
|
||||||
Node destination = myGraph.get(39229);
|
|
||||||
ShortestPathData data = new ShortestPathData(myGraph, origin, destination, arcInspector);
|
|
||||||
|
|
||||||
final ShortestPathAlgorithm algo = initAlgo(data);
|
|
||||||
final ShortestPathSolution path = algo.doRun();
|
|
||||||
|
|
||||||
BellmanFordAlgorithm bellman = new BellmanFordAlgorithm(data);
|
|
||||||
ShortestPathSolution bell_path = bellman.doRun();
|
|
||||||
|
|
||||||
assert(path.getPath().isValid());
|
|
||||||
assert(path.isFeasible());
|
|
||||||
assert((Math.abs(algo.getCostPath() - path.getPath().getMinimumTravelTime()) < 1.0));
|
|
||||||
assert(Math.abs(path.getPath().getMinimumTravelTime() - bell_path.getPath().getMinimumTravelTime()) < 1.0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
/*
|
/*
|
||||||
* Test du mode à vélo facultatif.
|
* Test du mode à vélo facultatif.
|
||||||
* Nous prenons une origine sur l'autoroute et une destination en dehors.
|
* On va vérifier que le chemin obtenu par vélo en dijkstra est bien le même,
|
||||||
* Ce chemin est donc censé être utilisable en vélo mais pas en voiture.
|
* que celui obtenu par vélo en bellman.
|
||||||
* Avec le filtre vélos, on obtient pas de chemin.
|
* Il est possible qu'un chemin en vélo n'existe pas. Par exemple, si le seul
|
||||||
* Avec le filtre voitures on obtient un chemin.
|
* chemin pour accéder à la destination est de passer par l'autoroute, il n'est
|
||||||
* Origine: 19135
|
* accessible qu'en voiture.
|
||||||
* Destination: 1980
|
* Carte utilisée : ../Maps/toulouse.mapgr
|
||||||
* PATH UTILISE : ../Paths/custom_paths/path_cyclist.path
|
|
||||||
*/
|
*/
|
||||||
public void chemin_velo_uniquement() {
|
public void chemin_velo_uniquement() {
|
||||||
|
|
||||||
|
Graph myGraph = graph.get(2);
|
||||||
// Filter: forBicyclesCustomT
|
// Filter: forBicyclesCustomT
|
||||||
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(4);
|
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(4);
|
||||||
|
Node origin = myGraph.get(0);
|
||||||
Graph myGraph = graph.get(2);
|
Node destination = myGraph.get(0);
|
||||||
Node origin = myGraph.get(19135);
|
int size_graph = myGraph.size();
|
||||||
Node destination = myGraph.get(1980);
|
|
||||||
|
|
||||||
ShortestPathData data = new ShortestPathData(myGraph, origin, destination, arcInspector);
|
nTestsWithBellman(myGraph, origin, destination, arcInspector, size_graph, 50);
|
||||||
|
|
||||||
ShortestPathAlgorithm algo_bicycle = initAlgo(data);
|
|
||||||
ShortestPathSolution path_bicycle = algo_bicycle.doRun();
|
|
||||||
|
|
||||||
BellmanFordAlgorithm bellman_bicycle = new BellmanFordAlgorithm(data);
|
|
||||||
ShortestPathSolution bell_path_bicycle = bellman_bicycle.doRun();
|
|
||||||
|
|
||||||
// Filter: forCarsL
|
|
||||||
ArcInspector new_Inspector = ArcInspectorFactory.getAllFilters().get(1);
|
|
||||||
data = new ShortestPathData(myGraph, origin, destination, new_Inspector);
|
|
||||||
|
|
||||||
ShortestPathAlgorithm algo_car = initAlgo(data);
|
|
||||||
ShortestPathSolution path_car = algo_car.doRun();
|
|
||||||
|
|
||||||
assertEquals(path_bicycle.getPath(), null);
|
|
||||||
assert(!path_bicycle.isFeasible());
|
|
||||||
assertEquals(bell_path_bicycle.getPath(), null);
|
|
||||||
assert(!bell_path_bicycle.isFeasible());
|
|
||||||
|
|
||||||
assert(path_car.getPath() != null);
|
|
||||||
assert(path_car.isFeasible());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
/*
|
/*
|
||||||
* On veut vérifier le bon fonctionnement des modes TIME et LENGTH.
|
* Permet de tester les chemins courts en distance.
|
||||||
* Pour cela, on va obtenir deux chemins avec l'algo de algo et vérifier
|
* Map: carre.mapgr
|
||||||
* que:
|
* 2000 chemins testés
|
||||||
* -le chemin TIME est plus rapide en durée que le chemin LENGTH
|
* Tous chemins permis
|
||||||
* -le chemin LENGTH est plus court en distance que le chemin LENGTH.
|
|
||||||
* On prend un grand chemin pour être sur d'avoir une différence :
|
|
||||||
* Origine: 16644
|
|
||||||
* Destination: 39229
|
|
||||||
* Mode: TIME/LENGTH
|
|
||||||
* PATH UTILISE : ../Paths/custom_paths/long_path_tls.path
|
|
||||||
*/
|
|
||||||
public void chemin_time_length_comparison() {
|
|
||||||
Graph myGraph = graph.get(2);
|
|
||||||
Node origin = myGraph.get(19135);
|
|
||||||
Node destination = myGraph.get(1980);
|
|
||||||
|
|
||||||
// Filter: forCarsL
|
|
||||||
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(1);
|
|
||||||
ShortestPathData data = new ShortestPathData(myGraph, origin, destination, arcInspector);
|
|
||||||
|
|
||||||
ShortestPathAlgorithm algo_L = initAlgo(data);
|
|
||||||
ShortestPathSolution path_L = algo_L.doRun();
|
|
||||||
|
|
||||||
// Filter: forCarsT
|
|
||||||
ArcInspector new_Inspector = ArcInspectorFactory.getAllFilters().get(2);
|
|
||||||
data = new ShortestPathData(myGraph, origin, destination, new_Inspector);
|
|
||||||
|
|
||||||
ShortestPathAlgorithm algo_T = initAlgo(data);
|
|
||||||
ShortestPathSolution path_T = algo_T.doRun();
|
|
||||||
|
|
||||||
assert(path_L.getPath().isValid());
|
|
||||||
assert(path_L.isFeasible());
|
|
||||||
assert(path_T.getPath().isValid());
|
|
||||||
assert(path_T.isFeasible());
|
|
||||||
|
|
||||||
assert((Math.abs(algo_L.getCostPath() - path_L.getPath().getLength()) < 1.0));
|
|
||||||
assert((Math.abs(algo_T.getCostPath() - path_T.getPath().getMinimumTravelTime()) < 1.0));
|
|
||||||
|
|
||||||
assert(path_L.getPath().getLength() < path_T.getPath().getLength());
|
|
||||||
assert(path_L.getPath().getMinimumTravelTime() > path_T.getPath().getMinimumTravelTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
/*
|
|
||||||
* Cette fois-ci, Bellman est trop long à utiliser même une seule fois.
|
|
||||||
* On va donc utiliser quelques techniques pour se rassurer.
|
|
||||||
* -vérifier certains noeuds comme départ, destination, noeud pivot.
|
|
||||||
* -vérifier le cout avec une estimation gentille.
|
|
||||||
* -etc.
|
|
||||||
* Origin: 279654
|
|
||||||
* Destination: 481936
|
|
||||||
* Mode: LENGTH
|
* Mode: LENGTH
|
||||||
* PATH UTILISE : ../Paths/custom_paths/long_chemin_midi_pyrenees.path
|
* Carte utilisée: ../Maps/carre.mapgr
|
||||||
*/
|
*/
|
||||||
public void chemin_long_Midi_pyrenees_length() {
|
public void cheminsCarreLENGTH() {
|
||||||
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
|
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0); // all arcs
|
||||||
Graph myGraph = graph.get(3);
|
Graph myGraph = graph.get(0);
|
||||||
Node origin = myGraph.get(279654);
|
|
||||||
Node destination = myGraph.get(481936);
|
|
||||||
ShortestPathData data = new ShortestPathData(myGraph, origin, destination, arcInspector);
|
|
||||||
|
|
||||||
final ShortestPathAlgorithm algo = initAlgo(data);
|
|
||||||
final ShortestPathSolution path = algo.doRun();
|
|
||||||
|
|
||||||
assert(path.getPath().isValid());
|
Node origin = myGraph.get(0);
|
||||||
assert(path.isFeasible());
|
Node destination = myGraph.get(0);
|
||||||
// On a des erreurs d'arrondi assez grande avec la distance, mais elles sont mineures
|
|
||||||
// relativement aux distance de 300000 ici.
|
|
||||||
// Elles sont causées par le fait que les chemi
|
|
||||||
assert((Math.abs(algo.getCostPath() - path.getPath().getLength())) < 1000.0);
|
|
||||||
// Probable explication :
|
|
||||||
// - `algo.getCostPath()` : somme de double
|
|
||||||
// - `path.getPath().getLength()` : somme de float
|
|
||||||
// Selon le chemin sélectionné on peut avoir une estimation de la longueur qu'on est censée avoir.
|
|
||||||
// Avec notre long chemin: entre 250 et 260 kilomètres.
|
|
||||||
assert(algo.getCostPath() > 250000 && algo.getCostPath() < 260000);
|
|
||||||
// On peut aussi supposer que le nombre d'arcs empruntés est très grand.
|
|
||||||
assert(path.getPath().getArcs().size() > 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
/*
|
|
||||||
* Cette fois-ci, Bellman est trop long à utiliser même une seule fois.
|
|
||||||
* On va donc utiliser quelques techniques pour se rassurer.
|
|
||||||
* -vérifier certains noeuds comme départ, destination, noeud pivot.
|
|
||||||
* -vérifier le cout avec une estimation gentille.
|
|
||||||
* -etc.
|
|
||||||
* Origin: 279654
|
|
||||||
* Destination: 481936
|
|
||||||
* Mode: LENGTH
|
|
||||||
* PATH UTILISE : ../Paths/custom_paths/long_chemin_midi_pyrenees.path
|
|
||||||
*/
|
|
||||||
public void chemin_long_Midi_pyrenees_time() {
|
|
||||||
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(2);
|
|
||||||
Graph myGraph = graph.get(3);
|
|
||||||
Node origin = myGraph.get(279654);
|
|
||||||
Node destination = myGraph.get(481936);
|
|
||||||
ShortestPathData data = new ShortestPathData(myGraph, origin, destination, arcInspector);
|
|
||||||
|
|
||||||
final ShortestPathAlgorithm algo = initAlgo(data);
|
|
||||||
final ShortestPathSolution path = algo.doRun();
|
|
||||||
|
|
||||||
assert(path.getPath().isValid());
|
|
||||||
assert(path.isFeasible());
|
|
||||||
// On a des erreurs d'arrondi assez grandes avec la distance
|
|
||||||
assert((Math.abs(algo.getCostPath() - path.getPath().getMinimumTravelTime())) < 1000.0);
|
|
||||||
// Selon le chemin sélectionné on peut avoir une estimation de la durée qu'on est censée avoir.
|
|
||||||
// Avec notre long chemin: entre 12000 et 13000 secondes.
|
|
||||||
assert(algo.getCostPath() > 12000 && algo.getCostPath() < 13000);
|
|
||||||
// On peut aussi supposer que le nombre d'arcs empruntés est très grand.
|
|
||||||
assert(path.getPath().getArcs().size() > 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
/*
|
|
||||||
* Chemin long sur la carte de Toulouse.
|
|
||||||
* Même si Bellman est de plus long à faire long à faire, ce test prend moins
|
|
||||||
* de 3s, on estime que ce n'est pas trop et on va utiliser Bellman.
|
|
||||||
* Par contre, dans le test sur la région midi_pyrenees qui arrive après, on va
|
|
||||||
* être obligé de trouver une autre solution.
|
|
||||||
* Origine: 16644
|
|
||||||
* Destination: 39229
|
|
||||||
* Mode: LENGTH
|
|
||||||
* PATH UTILISE : ../Paths/custom_paths/long_path_tls.path
|
|
||||||
*/
|
|
||||||
public void cheminsToulouse() {
|
|
||||||
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
|
|
||||||
Graph myGraph = graph.get(2);
|
|
||||||
Node origin = myGraph.get(16644);
|
|
||||||
Node destination = myGraph.get(39229);
|
|
||||||
|
|
||||||
Random rand = new Random();
|
|
||||||
|
|
||||||
int size_graph = myGraph.getNodes().size();
|
int size_graph = myGraph.getNodes().size();
|
||||||
|
|
||||||
for (int i = 0 ; i < 50 ; i++) {
|
nTestsWithBellman(myGraph, origin, destination, arcInspector, size_graph, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
/*
|
||||||
|
* Permet de tester les chemins courts en temps.
|
||||||
|
* Map: carre.mapgr
|
||||||
|
* 500 chemins testés
|
||||||
|
* Tous chemins permis
|
||||||
|
* Mode: LENGTH
|
||||||
|
* Carte utilisée: ../Maps/carre.mapgr
|
||||||
|
*/
|
||||||
|
public void cheminsCarreTIME() {
|
||||||
|
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(2); // all arcs
|
||||||
|
Graph myGraph = graph.get(0);
|
||||||
|
|
||||||
|
Node origin = myGraph.get(0);
|
||||||
|
Node destination = myGraph.get(0);
|
||||||
|
|
||||||
|
int size_graph = myGraph.getNodes().size();
|
||||||
|
|
||||||
|
nTestsWithBellman(myGraph, origin, destination, arcInspector, size_graph, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
//@Test
|
||||||
|
/*
|
||||||
|
* Permet de tester les chemins moyennement longs en distance (0 - 30 km).
|
||||||
|
* On teste 100 chemins sur la carte de Toulouse (environ 1 min d'exécution)
|
||||||
|
* Même si Bellman est de plus long à faire long à réaliser avec la taille du
|
||||||
|
* graphe, ce test prend moins d'une minute donc on va quand même utiliser Bellman.
|
||||||
|
* Par contre, dans le test sur la région midi_pyrenees / France qui arrive après,
|
||||||
|
* on va être obligé de trouver une autre solution (principale difficulté).
|
||||||
|
* Mode: LENGTH
|
||||||
|
* Carte utilisée : ../Maps/toulouse.mapgr
|
||||||
|
*/
|
||||||
|
public void cheminsToulouseLENGTH() {
|
||||||
|
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
|
||||||
|
Graph myGraph = graph.get(2);
|
||||||
|
Node origin = myGraph.get(0);
|
||||||
|
Node destination = myGraph.get(0);
|
||||||
|
|
||||||
|
int size_graph = myGraph.getNodes().size();
|
||||||
|
|
||||||
|
for (int i = 0 ; i < 100 ; i++) {
|
||||||
origin = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
origin = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
destination = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
destination = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
|
|
||||||
assertBellmanHasSameResult(myGraph, origin, destination, arcInspector);
|
assertBellmanHasSameResult(myGraph, origin, destination, arcInspector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@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)
|
||||||
|
* Même si Bellman est de plus long à faire long à réaliser avec la taille du
|
||||||
|
* graphe, ce test prend moins d'une minute donc on va quand même utiliser Bellman.
|
||||||
|
* Par contre, dans le test sur la région midi_pyrenees / France qui arrive après,
|
||||||
|
* on va être obligé de trouver une autre solution (principale difficulté).
|
||||||
|
* Mode: LENGTH
|
||||||
|
* Carte utilisée : ../Maps/toulouse.mapgr
|
||||||
|
*/
|
||||||
|
public void cheminsToulouseTIME() {
|
||||||
|
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
|
||||||
|
Graph myGraph = graph.get(2);
|
||||||
|
Node origin = myGraph.get(0);
|
||||||
|
Node destination = myGraph.get(0);
|
||||||
|
|
||||||
|
int size_graph = myGraph.getNodes().size();
|
||||||
|
|
||||||
|
for (int i = 0 ; i < 100 ; i++) {
|
||||||
|
origin = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
|
destination = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
|
|
||||||
|
assertBellmanHasSameResult(myGraph, origin, destination, arcInspector);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
/*
|
||||||
|
* On veut vérifier le bon fonctionnement des modes TIME et LENGTH.
|
||||||
|
* On va faire 100 tests pour vérifier le bon fonctionnement sur la carte
|
||||||
|
* de Toulouse
|
||||||
|
* Pour cela, on va obtenir deux chemins avec l'algo de algo et vérifier
|
||||||
|
* que:
|
||||||
|
* -le chemin TIME est plus rapide en durée que le chemin LENGTH
|
||||||
|
* -le chemin LENGTH est plus court en distance que le chemin TIME.
|
||||||
|
* On prend un grand chemin pour être sur d'avoir une différence :
|
||||||
|
* Mode: TIME/LENGTH
|
||||||
|
* Carte utilisée : ../Maps/toulouse.mapgr
|
||||||
|
*/
|
||||||
|
public void chemin_time_length_comparison() {
|
||||||
|
Graph myGraph = graph.get(2);
|
||||||
|
Node origin = myGraph.get(0);
|
||||||
|
Node destination = myGraph.get(0);
|
||||||
|
int size_graph = myGraph.size();
|
||||||
|
|
||||||
|
// Filter: allArcsL
|
||||||
|
ArcInspector arcInspectorL = ArcInspectorFactory.getAllFilters().get(0);
|
||||||
|
// Filter: forCarsT
|
||||||
|
ArcInspector arcInspectorT = ArcInspectorFactory.getAllFilters().get(2);
|
||||||
|
|
||||||
|
for (int i = 0 ; i < 100 ; i++) {
|
||||||
|
origin = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
|
destination = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
|
|
||||||
|
ShortestPathData data = new ShortestPathData(myGraph, origin, destination, arcInspectorL);
|
||||||
|
|
||||||
|
// Algo in mode LENGTH
|
||||||
|
ShortestPathAlgorithm algo_L = initAlgo(data);
|
||||||
|
ShortestPathSolution path_L = algo_L.doRun();
|
||||||
|
|
||||||
|
data = new ShortestPathData(myGraph, origin, destination, arcInspectorT);
|
||||||
|
|
||||||
|
// Algo in mode TIME
|
||||||
|
ShortestPathAlgorithm algo_T = initAlgo(data);
|
||||||
|
ShortestPathSolution path_T = algo_T.doRun();
|
||||||
|
|
||||||
|
if (path_L.getPath() != null) {
|
||||||
|
assert(path_L.getPath().isValid());
|
||||||
|
assert(path_L.isFeasible());
|
||||||
|
assert(path_T.getPath().isValid());
|
||||||
|
assert(path_T.isFeasible());
|
||||||
|
|
||||||
|
assert((Math.abs(algo_L.getCostPath() - path_L.getPath().getLength()) < 1.0));
|
||||||
|
assert((Math.abs(algo_T.getCostPath() - path_T.getPath().getMinimumTravelTime()) < 1.0));
|
||||||
|
|
||||||
|
assert(path_L.getPath().getLength() <= path_T.getPath().getLength());
|
||||||
|
assert(path_L.getPath().getMinimumTravelTime() >= path_T.getPath().getMinimumTravelTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
/*
|
||||||
|
* Cette fois-ci, Bellman est trop long à utiliser un grand nombre de fois.
|
||||||
|
* On va donc utiliser quelques techniques pour se rassurer:
|
||||||
|
* -Le cout en distance est au moins la distance à vol d'oiseau entre les noeuds.
|
||||||
|
* -les sous-chemins d'un PCC sont des PCC. Sachant cela, on doit être sur
|
||||||
|
* qu'en appliquant un second Dijkstra sur 2 noeuds aléatoires dans le path
|
||||||
|
* renvoyé par le premier Dijkstra (hors origine et destination), on
|
||||||
|
* obtient un chemin de coût inférieur au premier.
|
||||||
|
* On teste 10 PCC et pour chaque PCC 25 sous PCC
|
||||||
|
* Mode: LENGTH
|
||||||
|
* Carte utilisée : ../Maps/midi_pyrenees.mapgr
|
||||||
|
*/
|
||||||
|
public void cheminsMidiPyreneesLENGTH() {
|
||||||
|
Graph myGraph = graph.get(3);
|
||||||
|
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
|
||||||
|
Node origin = myGraph.get(0);
|
||||||
|
Node destination = myGraph.get(0);
|
||||||
|
int size_graph = myGraph.size();
|
||||||
|
int longueur_path = 0;
|
||||||
|
Node noeudSelectionneOrigine = myGraph.get(0);
|
||||||
|
Node noeudSelectionneDestination = myGraph.get(0);
|
||||||
|
|
||||||
|
for (int i = 0 ; i < 10 ; i++) {
|
||||||
|
origin = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
|
destination = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
|
|
||||||
|
ShortestPathData data = new ShortestPathData(myGraph, origin, destination, arcInspector);
|
||||||
|
|
||||||
|
final ShortestPathAlgorithm algo = initAlgo(data);
|
||||||
|
final ShortestPathSolution path = algo.doRun();
|
||||||
|
|
||||||
|
if (path.getPath() != null) {
|
||||||
|
assert(path.getPath().isValid());
|
||||||
|
assert(path.isFeasible());
|
||||||
|
assert((Math.abs(algo.getCostPath() - path.getPath().getLength())) < 1.0);
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
|
for (int j = 0; j < 25 ; j++) {
|
||||||
|
longueur_path = path.getPath().size();
|
||||||
|
int milieu_path = longueur_path / 2;
|
||||||
|
|
||||||
|
int indiceOrigine = Math.abs(rand.nextInt()) % milieu_path;
|
||||||
|
int indiceDestination = milieu_path + Math.abs(rand.nextInt()) % milieu_path - 1;
|
||||||
|
|
||||||
|
noeudSelectionneOrigine = path.getPath().getArcs().get(indiceOrigine).getOrigin();
|
||||||
|
|
||||||
|
noeudSelectionneDestination = path.getPath().getArcs().get(indiceDestination).getOrigin();
|
||||||
|
|
||||||
|
ShortestPathData dataSousPCC = new ShortestPathData(myGraph, noeudSelectionneOrigine, noeudSelectionneDestination, arcInspector);
|
||||||
|
|
||||||
|
final ShortestPathAlgorithm algoSousPCC = initAlgo(dataSousPCC);
|
||||||
|
final ShortestPathSolution pathSousPCC = algoSousPCC.doRun();
|
||||||
|
|
||||||
|
if (path.getPath() != null) {
|
||||||
|
assert(pathSousPCC.getPath().isValid());
|
||||||
|
assert(pathSousPCC.isFeasible());
|
||||||
|
assert((Math.abs(algoSousPCC.getCostPath() - pathSousPCC.getPath().getLength())) < 1.0);
|
||||||
|
|
||||||
|
// sous PCC de coût inférieur au PCC
|
||||||
|
assert(algoSousPCC.getCostPath() <= algo.getCostPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
/*
|
||||||
|
* Cette fois-ci, Bellman est trop long à utiliser un grand nombre de fois.
|
||||||
|
* On va donc utiliser quelques techniques pour se rassurer:
|
||||||
|
* -Le temps mis est plus grand que le temps à vitesse maximale permise.
|
||||||
|
* -les sous-chemins d'un PCC sont des PCC. Sachant cela, on doit être sur
|
||||||
|
* qu'en appliquant un second Dijkstra sur 2 noeuds aléatoires dans le path
|
||||||
|
* renvoyé par le premier Dijkstra (hors origine et destination), on
|
||||||
|
* obtient un chemin de coût inférieur au premier.
|
||||||
|
* On teste 10 PCC et pour chaque PCC 25 sous PCC
|
||||||
|
* Mode: TIME
|
||||||
|
* Carte utilisée : ../Maps/midi_pyrenees.mapgr
|
||||||
|
*/
|
||||||
|
public void cheminMidiPyreneesTIME() {
|
||||||
|
Graph myGraph = graph.get(3);
|
||||||
|
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(2);
|
||||||
|
Node origin = myGraph.get(0);
|
||||||
|
Node destination = myGraph.get(0);
|
||||||
|
int size_graph = myGraph.size();
|
||||||
|
int longueur_path = 0;
|
||||||
|
Node noeudSelectionneOrigine;
|
||||||
|
Node noeudSelectionneDestination;
|
||||||
|
|
||||||
|
for (int i = 0 ; i < 10 ; i++) {
|
||||||
|
origin = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
|
destination = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
||||||
|
|
||||||
|
ShortestPathData data = new ShortestPathData(myGraph, origin, destination, arcInspector);
|
||||||
|
|
||||||
|
final ShortestPathAlgorithm algo = initAlgo(data);
|
||||||
|
final ShortestPathSolution path = algo.doRun();
|
||||||
|
|
||||||
|
if (path.getPath() != null) {
|
||||||
|
assert(path.getPath().isValid());
|
||||||
|
assert(path.isFeasible());
|
||||||
|
assert((Math.abs(algo.getCostPath() - path.getPath().getMinimumTravelTime())) < 10.0);
|
||||||
|
|
||||||
|
double tempsFromOriginToDestination = Point.distance(origin.getPoint(), destination.getPoint()) / (1000 * data.getGraph().getGraphInformation().getMaximumSpeed());
|
||||||
|
|
||||||
|
// Temps supérieur ou égal (improbable voire impossible) au chemin à vol d'oiseau à la vitesse maximale.
|
||||||
|
assert(tempsFromOriginToDestination <= algo.getCostPath());
|
||||||
|
|
||||||
|
for (int j = 0; j < 25 ; j++) {
|
||||||
|
longueur_path = path.getPath().size();
|
||||||
|
int milieu_path = longueur_path / 2;
|
||||||
|
|
||||||
|
int indiceOrigine = Math.abs(rand.nextInt()) % milieu_path;
|
||||||
|
int indiceDestination = milieu_path + Math.abs(rand.nextInt()) % milieu_path - 1;
|
||||||
|
|
||||||
|
noeudSelectionneOrigine = path.getPath().getArcs().get(indiceOrigine).getOrigin();
|
||||||
|
|
||||||
|
noeudSelectionneDestination = path.getPath().getArcs().get(indiceDestination).getOrigin();
|
||||||
|
|
||||||
|
ShortestPathData dataSousPCC = new ShortestPathData(myGraph, noeudSelectionneOrigine, noeudSelectionneDestination, arcInspector);
|
||||||
|
|
||||||
|
final ShortestPathAlgorithm algoSousPCC = initAlgo(dataSousPCC);
|
||||||
|
final ShortestPathSolution pathSousPCC = algoSousPCC.doRun();
|
||||||
|
|
||||||
|
if (path.getPath() != null) {
|
||||||
|
assert(pathSousPCC.getPath().isValid());
|
||||||
|
assert(pathSousPCC.isFeasible());
|
||||||
|
assert((Math.abs(algoSousPCC.getCostPath() - pathSousPCC.getPath().getMinimumTravelTime())) < 1.0);
|
||||||
|
|
||||||
|
// sous PCC de coût inférieur au PCC
|
||||||
|
assert(algoSousPCC.getCostPath() <= algo.getCostPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue