LCOV - code coverage report
Current view: top level - app/include/Static/supply - BPRNotConvexNetwork.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2023-08-17 16:45:52 Functions: 0 0 -

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "Static/SUMOAdapter.hpp"
       4             : #include "Static/supply/BPRNetwork.hpp"
       5             : #include "Static/supply/NetworkDifferentiable.hpp"
       6             : #include "data/SUMO/Network.hpp"
       7             : #include "data/SUMO/NetworkTAZ.hpp"
       8             : #include "data/SUMO/TAZ.hpp"
       9             : 
      10             : namespace Static {
      11             : 
      12             : class BPRConvexNetwork;
      13             : 
      14             : class BPRNotConvexNetwork: public BPRNetwork {
      15             :    public:
      16             :     template<typename T>
      17             :     class Loader {
      18             :        public:
      19             :         BPRNotConvexNetwork *load(const T &t);
      20             :     };
      21             : 
      22             :     struct NormalEdge: public BPRNetwork::NormalEdge {
      23             :         template<typename T>
      24             :         friend class BPRNotConvexNetwork::Loader;
      25             : 
      26             :         friend BPRNotConvexNetwork;
      27             : 
      28             :        protected:
      29             :         NormalEdge(ID id, Node u, Node v, const BPRNetwork &network, Time t0, Flow c);
      30             :     };
      31             :     struct ConnectionEdge: public BPRNetwork::ConnectionEdge {
      32             :         template<typename T>
      33             :         friend class BPRNotConvexNetwork::Loader;
      34             : 
      35             :         friend BPRNotConvexNetwork;
      36             : 
      37             :         std::vector<std::vector<std::pair<const Edge *, double>>> conflicts;
      38             : 
      39             :        protected:
      40             :         ConnectionEdge(ID id, Node u, Node v, const BPRNetwork &network, Time t0, Flow c);
      41             : 
      42             :        private:
      43             :         Time getLessPriorityCapacity(const Solution &x) const;
      44             : 
      45             :        public:
      46             :         virtual Time calculateCost(const Solution &x) const;
      47             :         virtual Time calculateCostGlobal(const Solution &x) const;
      48             :         virtual Time calculateCostDerivative(const Solution &x) const;
      49             :     };
      50             : 
      51             :    public:
      52             :     BPRNotConvexNetwork(Time alpha = 0.15, Time beta = 4.0);
      53             : 
      54             :     virtual NormalEdge     *addNormalEdge(Edge::ID id, Node u, Node v, const BPRNetwork &network, Time t0, Flow c);
      55             :     virtual ConnectionEdge *addConnectionEdge(Edge::ID id, Node u, Node v, const BPRNetwork &network, Time t0, Flow c);
      56             : 
      57             :     BPRConvexNetwork makeConvex(const Solution &x) const;
      58             : };
      59             : 
      60             : template<>
      61           6 : class BPRNotConvexNetwork::Loader<SUMO::NetworkTAZs>: public BPRNetwork::Loader<SUMO::NetworkTAZs> {
      62             :     BPRNotConvexNetwork *networkNotConvex;
      63             : 
      64             :     // clang-format off
      65             :     std::map<
      66             :         SUMO::Network::Edge::ID,
      67             :         std::map<
      68             :             SUMO::Network::Edge::ID,
      69             :             ConnectionEdge::ID
      70             :         >
      71             :     > connectionMap;
      72             :     // clang-format on
      73             : 
      74             :     void addConnectionConflicts(const SUMO::NetworkTAZs &sumo, const Edge::ID &eID);
      75             : 
      76             :     size_t getNumberLanes(const SUMO::NetworkTAZs &sumo, const ConnectionEdge &e) const;
      77             : 
      78             :    public:
      79             :     virtual void clear();
      80             : 
      81             :     virtual BPRNotConvexNetwork *load(const SUMO::NetworkTAZs &sumo);
      82             : };
      83             : 
      84             : }  // namespace Static

Generated by: LCOV version 1.14