From baca5e465597f3feaf861bab0ba105331adac642 Mon Sep 17 00:00:00 2001 From: Romain BERNARD <30secondstodraw@gmail.com> Date: Tue, 19 Mar 2024 18:17:18 +0100 Subject: [PATCH] shortest path container testing --- test/debug.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/test/debug.cpp b/test/debug.cpp index 999d44c..2b7f45f 100644 --- a/test/debug.cpp +++ b/test/debug.cpp @@ -5,6 +5,7 @@ #include "../src/instance/graph/Graph.h" #include "../src/ShortestPath/Transit/TransitStateContainer.h" #include "../src/ShortestPath/Transit/TransitShortestPathPrecompute.h" +#include "../src/ShortestPath/Transit/TransitShortestPathContainer.h" int main() { // Graph give_me_a_name("../resources/test/instances/basic_debug_instance/nodes.csv", @@ -17,38 +18,50 @@ int main() { Graph graphFromSingleFile("../resources/test/instances/" + instanceFolder + datFile); graphFromSingleFile.exportGraphToFiles("../resources/test/outputs/" + instanceFolder); + TransitShortestPathContainer contiguousContainer(graphFromSingleFile.getNbNodes()); for(auto& ptLine : graphFromSingleFile.getPTLines()) { for(int i = 0; i < ptLine.size(); ++i) { for (auto& startingTime: ptLine.getTimetable(i)) { - TransitShortestPathPrecompute::executeAlgorithm(graphFromSingleFile, ptLine.getNode(i),startingTime); + contiguousContainer.addShortestPathCollection(i, startingTime, graphFromSingleFile.getNbNodes(), + TransitShortestPathPrecompute::executeAlgorithm(graphFromSingleFile, ptLine.getNode(i),startingTime)); + contiguousContainer.getShortestPathsFromTime(i, startingTime - 1); } } } + TransitShortestPathContainer crossingContainer(graphFromSingleFile.getNbNodes()); Graph crossingLinesGraph("../resources/test/instances/multiple_crossing_lines_debug_instance/" + datFile); for(auto& ptLine : crossingLinesGraph.getPTLines()) { for(int i = 0; i < ptLine.size(); ++i) { for (auto& startingTime: ptLine.getTimetable(i)) { - TransitShortestPathPrecompute::executeAlgorithm(crossingLinesGraph, ptLine.getNode(i),startingTime); + crossingContainer.addShortestPathCollection(i, startingTime, crossingLinesGraph.getNbNodes(), + TransitShortestPathPrecompute::executeAlgorithm(crossingLinesGraph, ptLine.getNode(i),startingTime)); + crossingContainer.getShortestPathsFromTime(i, startingTime - 1); } } } + TransitShortestPathContainer cycleContainer(graphFromSingleFile.getNbNodes()); Graph cyclingLineGraph("../resources/test/instances/cycling_line_debug_instance/" + datFile); for(auto& ptLine : cyclingLineGraph.getPTLines()) { for(int i = 0; i < ptLine.size(); ++i) { for (auto& startingTime: ptLine.getTimetable(i)) { - TransitShortestPathPrecompute::executeAlgorithm(cyclingLineGraph, ptLine.getNode(i),startingTime); + cycleContainer.addShortestPathCollection(i, startingTime, cyclingLineGraph.getNbNodes(), + TransitShortestPathPrecompute::executeAlgorithm(cyclingLineGraph, ptLine.getNode(i),startingTime)); + cycleContainer.getShortestPathsFromTime(i, startingTime - 1); } } } + TransitShortestPathContainer multiCycleContainer(graphFromSingleFile.getNbNodes()); Graph multipleCyclingLinesGraph("../resources/test/instances/multiple_cycling_lines_debug_instance/" + datFile); for(auto& ptLine : multipleCyclingLinesGraph.getPTLines()) { for(int i = 0; i < ptLine.size(); ++i) { for (auto& startingTime: ptLine.getTimetable(i)) { - TransitShortestPathPrecompute::executeAlgorithm(multipleCyclingLinesGraph, ptLine.getNode(i),startingTime); + multiCycleContainer.addShortestPathCollection(i, startingTime, multipleCyclingLinesGraph.getNbNodes(), + TransitShortestPathPrecompute::executeAlgorithm(multipleCyclingLinesGraph, ptLine.getNode(i),startingTime)); + multiCycleContainer.getShortestPathsFromTime(i, startingTime - 1); } } } -- GitLab