Test: sous pcc est un pcc : vérification arcs
This commit is contained in:
parent
45adcbeb8e
commit
44991cfab2
1 changed files with 15 additions and 15 deletions
|
@ -274,12 +274,7 @@ public abstract class ShortestPathAlgorithmTest {
|
||||||
|
|
||||||
int size_graph = myGraph.getNodes().size();
|
int size_graph = myGraph.getNodes().size();
|
||||||
|
|
||||||
for (int i = 0 ; i < 100 ; i++) {
|
nTestsWithBellman(myGraph, origin, destination, arcInspector, size_graph, 100);
|
||||||
origin = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
|
||||||
destination = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
|
||||||
|
|
||||||
assertBellmanHasSameResult(myGraph, origin, destination, arcInspector);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
|
@ -301,12 +296,7 @@ public abstract class ShortestPathAlgorithmTest {
|
||||||
|
|
||||||
int size_graph = myGraph.getNodes().size();
|
int size_graph = myGraph.getNodes().size();
|
||||||
|
|
||||||
for (int i = 0 ; i < 100 ; i++) {
|
nTestsWithBellman(myGraph, origin, destination, arcInspector, size_graph, 100);
|
||||||
origin = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
|
||||||
destination = myGraph.get(Math.abs(rand.nextInt()) % size_graph);
|
|
||||||
|
|
||||||
assertBellmanHasSameResult(myGraph, origin, destination, arcInspector);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -372,7 +362,9 @@ public abstract class ShortestPathAlgorithmTest {
|
||||||
* -les sous-chemins d'un PCC sont des PCC. Sachant cela, on doit être sur
|
* -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
|
* qu'en appliquant un second Dijkstra sur 2 noeuds aléatoires dans le path
|
||||||
* renvoyé par le premier Dijkstra (hors origine et destination), on
|
* renvoyé par le premier Dijkstra (hors origine et destination), on
|
||||||
* obtient un chemin de coût inférieur au premier.
|
* obtient :
|
||||||
|
* -un plus court chemin qui est le même que le sous chemin relevé (sous PCC).
|
||||||
|
* -un plus court chemin de coût inférieur au chemin dont il a été extrait.
|
||||||
* On teste 10 PCC et pour chaque PCC 25 sous PCC
|
* On teste 10 PCC et pour chaque PCC 25 sous PCC
|
||||||
* Mode: LENGTH
|
* Mode: LENGTH
|
||||||
* Carte utilisée : ../Maps/midi_pyrenees.mapgr
|
* Carte utilisée : ../Maps/midi_pyrenees.mapgr
|
||||||
|
@ -423,6 +415,9 @@ public abstract class ShortestPathAlgorithmTest {
|
||||||
final ShortestPathSolution pathSousPCC = algoSousPCC.doRun();
|
final ShortestPathSolution pathSousPCC = algoSousPCC.doRun();
|
||||||
|
|
||||||
if (path.getPath() != null) {
|
if (path.getPath() != null) {
|
||||||
|
for (int k = 0 ; k < pathSousPCC.getPath().size()-1; k++) {
|
||||||
|
assert(pathSousPCC.getPath().getArcs().get(k) == path.getPath().getArcs().get(indiceOrigine + k));
|
||||||
|
}
|
||||||
assert(pathSousPCC.getPath().isValid());
|
assert(pathSousPCC.getPath().isValid());
|
||||||
assert(pathSousPCC.isFeasible());
|
assert(pathSousPCC.isFeasible());
|
||||||
assert((Math.abs(algoSousPCC.getCostPath() - pathSousPCC.getPath().getLength())) < 1.0);
|
assert((Math.abs(algoSousPCC.getCostPath() - pathSousPCC.getPath().getLength())) < 1.0);
|
||||||
|
@ -443,7 +438,9 @@ public abstract class ShortestPathAlgorithmTest {
|
||||||
* -les sous-chemins d'un PCC sont des PCC. Sachant cela, on doit être sur
|
* -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
|
* qu'en appliquant un second Dijkstra sur 2 noeuds aléatoires dans le path
|
||||||
* renvoyé par le premier Dijkstra (hors origine et destination), on
|
* renvoyé par le premier Dijkstra (hors origine et destination), on
|
||||||
* obtient un chemin de coût inférieur au premier.
|
* obtient :
|
||||||
|
* -un plus court chemin qui est le même que le sous chemin relevé.
|
||||||
|
* -un plus court chemin de coût inférieur au chemin dont il a été extrait.
|
||||||
* On teste 10 PCC et pour chaque PCC 25 sous PCC
|
* On teste 10 PCC et pour chaque PCC 25 sous PCC
|
||||||
* Mode: TIME
|
* Mode: TIME
|
||||||
* Carte utilisée : ../Maps/midi_pyrenees.mapgr
|
* Carte utilisée : ../Maps/midi_pyrenees.mapgr
|
||||||
|
@ -485,7 +482,6 @@ public abstract class ShortestPathAlgorithmTest {
|
||||||
int indiceDestination = milieu_path + Math.abs(rand.nextInt()) % milieu_path - 1;
|
int indiceDestination = milieu_path + Math.abs(rand.nextInt()) % milieu_path - 1;
|
||||||
|
|
||||||
noeudSelectionneOrigine = path.getPath().getArcs().get(indiceOrigine).getOrigin();
|
noeudSelectionneOrigine = path.getPath().getArcs().get(indiceOrigine).getOrigin();
|
||||||
|
|
||||||
noeudSelectionneDestination = path.getPath().getArcs().get(indiceDestination).getOrigin();
|
noeudSelectionneDestination = path.getPath().getArcs().get(indiceDestination).getOrigin();
|
||||||
|
|
||||||
ShortestPathData dataSousPCC = new ShortestPathData(myGraph, noeudSelectionneOrigine, noeudSelectionneDestination, arcInspector);
|
ShortestPathData dataSousPCC = new ShortestPathData(myGraph, noeudSelectionneOrigine, noeudSelectionneDestination, arcInspector);
|
||||||
|
@ -494,6 +490,9 @@ public abstract class ShortestPathAlgorithmTest {
|
||||||
final ShortestPathSolution pathSousPCC = algoSousPCC.doRun();
|
final ShortestPathSolution pathSousPCC = algoSousPCC.doRun();
|
||||||
|
|
||||||
if (path.getPath() != null) {
|
if (path.getPath() != null) {
|
||||||
|
for (int k = 0 ; k < pathSousPCC.getPath().size()-1; k++) {
|
||||||
|
assert(pathSousPCC.getPath().getArcs().get(k) == path.getPath().getArcs().get(indiceOrigine + k));
|
||||||
|
}
|
||||||
assert(pathSousPCC.getPath().isValid());
|
assert(pathSousPCC.getPath().isValid());
|
||||||
assert(pathSousPCC.isFeasible());
|
assert(pathSousPCC.isFeasible());
|
||||||
assert((Math.abs(algoSousPCC.getCostPath() - pathSousPCC.getPath().getMinimumTravelTime())) < 1.0);
|
assert((Math.abs(algoSousPCC.getCostPath() - pathSousPCC.getPath().getMinimumTravelTime())) < 1.0);
|
||||||
|
@ -506,3 +505,4 @@ public abstract class ShortestPathAlgorithmTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue