Line data Source code
1 : #pragma once 2 : 3 : #include <string> 4 : #include <unordered_map> 5 : #include <vector> 6 : 7 : namespace VISUM { 8 : /** 9 : * @brief Demand in O-format file. 10 : * 11 : * See: 12 : * - http://www.chinautc.com/information/manage/UNCC_Editor/uploadfile/20081105144806983.pdf 13 : * - https://sumo.dlr.de/docs/Demand/Importing_O/D_Matrices.html#the_o-format_visumvissim 14 : * for more info on the VISUM O-format for matrices. 15 : */ 16 2 : class OFormatDemand { 17 : public: 18 : typedef std::string Node; 19 : typedef double Flow; 20 : typedef double Time; 21 : 22 : private: 23 : Time from, to; 24 : 25 : double factor; 26 : 27 : std::unordered_map<Node, std::unordered_map<Node, Flow>> flows; 28 : 29 : public: 30 : Time getFrom() const; 31 : Time getTo() const; 32 : 33 : void addDemand(Node u, Node v, Flow f); 34 : std::vector<Node> getStartNodes() const; 35 : std::vector<Node> getDestinations(Node u) const; 36 : Flow getDemand(Node u, Node v) const; 37 : 38 : static OFormatDemand loadFromFile(const std::string &path); 39 : }; 40 : } // namespace VISUM