Skip to content
Snippets Groups Projects
Commit 27ac6610 authored by Romain BERNARD's avatar Romain BERNARD Committed by Romain BERNARD
Browse files

shortest path container implementation

parent b23d56c5
No related branches found
No related tags found
1 merge request!1Transit algorithm implementation
......@@ -3,6 +3,7 @@
//
#include "TransitShortestPathContainer.h"
#include "TransitStateContainer.h"
void TransitShortestPathContainer::addShortestPathCollection(int startNodeIndex,
const std::pair<int, std::vector<TransitShortestPath>>& shortestPathList) {
......@@ -10,13 +11,13 @@ void TransitShortestPathContainer::addShortestPathCollection(int startNodeIndex,
}
void TransitShortestPathContainer::addShortestPathCollection(int startNodeIndex, int startingInstant, int graphSize,
const std::vector<TransitAlgorithmState>& algorithmResultStates) {
const TransitStateContainer& algorithmResultStates) {
std::vector<TransitShortestPath> shortestPathList;
shortestPathList.reserve(graphSize);
//Convert states to shortest paths and add to collection
for(const auto& state: algorithmResultStates) {
shortestPathList.emplace_back(state);
for(int i = 0; i < graphSize; ++i) {
shortestPathList.emplace_back(algorithmResultStates.getBestSolution(i));
}
//Add the (startingInstant, pathVector) pair at the appropriate node index
......
......@@ -8,14 +8,17 @@
#include <vector>
#include "TransitShortestPath.h"
#include "TransitStateContainer.h"
class TransitShortestPathContainer {
private:
std::vector<std::vector<std::pair<int, std::vector<TransitShortestPath>>>> container; //NodeVector< PairVector<Pair<Instant, NodeVector<ShortestPath> >> >
public:
explicit TransitShortestPathContainer(int size) { container.resize(size); }
explicit TransitShortestPathContainer(size_t size) { container.resize(size); }
void addShortestPathCollection(int startNodeIndex, const std::pair<int, std::vector<TransitShortestPath>>& shortestPathList);
void addShortestPathCollection(int startNodeIndex, int startingInstant, int graphSize, const std::vector<TransitAlgorithmState>& algorithmResultStates);
void addShortestPathCollection(int startNodeIndex, int startingInstant, int graphSize, const TransitStateContainer& algorithmResultStates);
std::vector<std::pair<int, std::vector<TransitShortestPath>>>::iterator getShortestPathsFromTime(int startNodeIndex, int earliestStartInstant);
std::pair<int, TransitShortestPath> getShortestPathToYFromTime(int startNodeIndex, int earliestStartInstant, int goalNode);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment