LCOV - code coverage report
Current view: top level - app/src/Static/supply - BPRConvexNetwork.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 32 0.0 %
Date: 2023-08-17 16:45:52 Functions: 0 8 0.0 %

          Line data    Source code
       1             : #include "Static/supply/BPRConvexNetwork.hpp"
       2             : 
       3             : #include "Static/FixedSolution.hpp"
       4             : 
       5             : using namespace std;
       6             : using namespace Static;
       7             : 
       8           0 : BPRConvexNetwork::Edge::Edge(
       9             :     const BPRConvexNetwork    &bprConvexNetwork_,
      10             :     const BPRNotConvexNetwork &bprNotConvex_,
      11             :     Edge::ID                   id_
      12           0 : ):
      13             :     NetworkDifferentiable::Edge(
      14             :         id_,
      15           0 :         bprNotConvex_.getEdge(id_).u,
      16           0 :         bprNotConvex_.getEdge(id_).v
      17             :     ),
      18             :     bprConvex(bprConvexNetwork_),
      19           0 :     bprNotConvex(bprNotConvex_) {}
      20             : 
      21           0 : Time BPRConvexNetwork::Edge::calculateCost(const Solution &x) const {
      22           0 :     FixedSolution x_ = bprConvex.solution;
      23           0 :     x_.setFlowInEdge(id, x.getFlowInEdge(id));
      24           0 :     return bprNotConvex.getEdge(id).calculateCost(x_);
      25             : }
      26             : 
      27           0 : Time BPRConvexNetwork::Edge::calculateCostGlobal(const Solution &x) const {
      28           0 :     FixedSolution x_ = bprConvex.solution;
      29           0 :     x_.setFlowInEdge(id, x.getFlowInEdge(id));
      30           0 :     return bprNotConvex.getEdge(id).calculateCostGlobal(x_);
      31             : }
      32             : 
      33           0 : Time BPRConvexNetwork::Edge::calculateCostDerivative(const Solution &x) const {
      34           0 :     FixedSolution x_ = bprConvex.solution;
      35           0 :     x_.setFlowInEdge(id, x.getFlowInEdge(id));
      36           0 :     return bprNotConvex.getEdge(id).calculateCostDerivative(x_);
      37             : }
      38             : 
      39           0 : BPRConvexNetwork::BPRConvexNetwork(const BPRNotConvexNetwork &bprNotConvex_, const Solution &solution_):
      40           0 :     bprNotConvex(bprNotConvex_), solution(solution_) {}
      41             : 
      42           0 : vector<Static::NetworkDifferentiable::Node> BPRConvexNetwork::getNodes() const {
      43           0 :     return bprNotConvex.getNodes();
      44             : }
      45             : 
      46           0 : BPRConvexNetwork::Edge &BPRConvexNetwork::getEdge(Edge::ID eid) const {
      47           0 :     if(edges.count(eid))
      48           0 :         return edges.at(eid);
      49             :     else {
      50             :         // clang-format off
      51           0 :         return edges.emplace(
      52             :             eid,
      53           0 :             Edge(*this, bprNotConvex, eid)
      54           0 :         ).first->second;
      55             :         // clang-format on
      56             :     }
      57             : }
      58             : 
      59           0 : vector<Network::Edge *> BPRConvexNetwork::getAdj(Node u) const {
      60           0 :     vector<Network::Edge *> adj;
      61           0 :     for(auto e: bprNotConvex.getAdj(u)) {
      62           0 :         adj.push_back(new Edge(*this, bprNotConvex, e->id));
      63             :     }
      64           0 :     return adj;
      65             : }

Generated by: LCOV version 1.14