Compare commits
No commits in common. "a75f05b9a3b11638e5a41a6e7b14aa991b72b132" and "45adcbeb8e6fd80d53bdbaa7276bf94b7173b7c2" have entirely different histories.
a75f05b9a3
...
45adcbeb8e
1 changed files with 15 additions and 21 deletions
|
|
@ -274,7 +274,12 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
|
||||
int size_graph = myGraph.getNodes().size();
|
||||
|
||||
nTestsWithBellman(myGraph, origin, destination, arcInspector, size_graph, 100);
|
||||
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
|
||||
|
|
@ -296,7 +301,12 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
|
||||
int size_graph = myGraph.getNodes().size();
|
||||
|
||||
nTestsWithBellman(myGraph, origin, destination, arcInspector, size_graph, 100);
|
||||
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
|
||||
|
|
@ -362,9 +372,7 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
* -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 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.
|
||||
* 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
|
||||
|
|
@ -415,12 +423,6 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
final ShortestPathSolution pathSousPCC = algoSousPCC.doRun();
|
||||
|
||||
if (path.getPath() != null) {
|
||||
// Note: comme les chemins des arcs sont récupérés au même en droit entre pathSousPCC et path,
|
||||
// on peut comparer directement les objets soit leurs adresses. Sinon, il aurait fallu comparer
|
||||
// l'id des noeuds origines et destination du chemin.
|
||||
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.isFeasible());
|
||||
assert((Math.abs(algoSousPCC.getCostPath() - pathSousPCC.getPath().getLength())) < 1.0);
|
||||
|
|
@ -441,9 +443,7 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
* -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 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.
|
||||
* 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
|
||||
|
|
@ -485,6 +485,7 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
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);
|
||||
|
|
@ -493,12 +494,6 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
final ShortestPathSolution pathSousPCC = algoSousPCC.doRun();
|
||||
|
||||
if (path.getPath() != null) {
|
||||
// Note: comme les chemins des arcs sont récupérés au même en droit entre pathSousPCC et path,
|
||||
// on peut comparer directement les objets soit leurs adresses. Sinon, il aurait fallu comparer
|
||||
// l'id des noeuds origines et destination du chemin.
|
||||
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.isFeasible());
|
||||
assert((Math.abs(algoSousPCC.getCostPath() - pathSousPCC.getPath().getMinimumTravelTime())) < 1.0);
|
||||
|
|
@ -511,4 +506,3 @@ public abstract class ShortestPathAlgorithmTest {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue