Line data Source code
1 : #pragma once 2 : 3 : #include "Static/supply/BPRNotConvexNetwork.hpp" 4 : #include "Static/supply/NetworkDifferentiable.hpp" 5 : 6 : namespace Static { 7 0 : class BPRConvexNetwork: public NetworkDifferentiable { 8 : public: 9 : struct Edge; 10 : 11 : private: 12 : friend struct Edge; 13 : const BPRNotConvexNetwork &bprNotConvex; 14 : const Solution &solution; 15 : 16 : public: 17 : struct Edge: public NetworkDifferentiable::Edge { 18 : friend class BPRConvexNetwork; 19 : 20 : const BPRConvexNetwork &bprConvex; 21 : const BPRNotConvexNetwork &bprNotConvex; 22 : 23 : Edge( 24 : const BPRConvexNetwork &bprConvexNetwork_, 25 : const BPRNotConvexNetwork &bprNotConvex_, 26 : Edge::ID id_ 27 : ); 28 : 29 : public: 30 : virtual Time calculateCost(const Solution &x) const; 31 : virtual Time calculateCostGlobal(const Solution &x) const; 32 : virtual Time calculateCostDerivative(const Solution &x) const; 33 : }; 34 : 35 : private: 36 : mutable std::unordered_map<Edge::ID, Edge> edges; 37 : 38 : public: 39 : BPRConvexNetwork(const BPRNotConvexNetwork &bprNotConvex_, const Solution &solution_); 40 : 41 : virtual std::vector<Node> getNodes() const; 42 : virtual Edge &getEdge(Edge::ID e) const; 43 : virtual std::vector<Network::Edge *> getAdj(Node u) const; 44 : }; 45 : } // namespace Static