LCOV - code coverage report
Current view: top level - src/marouter - ROMAAssignments.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 2 2
Test Date: 2024-12-21 15:45:41 Functions: - 0 0

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
       4              : // This program and the accompanying materials are made available under the
       5              : // terms of the Eclipse Public License 2.0 which is available at
       6              : // https://www.eclipse.org/legal/epl-2.0/
       7              : // This Source Code may also be made available under the following Secondary
       8              : // Licenses when the conditions for such availability set forth in the Eclipse
       9              : // Public License 2.0 are satisfied: GNU General Public License, version 2
      10              : // or later which is available at
      11              : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      12              : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      13              : /****************************************************************************/
      14              : /// @file    ROMAAssignments.h
      15              : /// @author  Yun-Pang Floetteroed
      16              : /// @author  Laura Bieker
      17              : /// @author  Michael Behrisch
      18              : /// @date    Feb 2013
      19              : ///
      20              : // Assignment methods
      21              : /****************************************************************************/
      22              : #pragma once
      23              : #include <config.h>
      24              : 
      25              : #include <utils/router/SUMOAbstractRouter.h>
      26              : #include <utils/common/SUMOTime.h>
      27              : 
      28              : // ===========================================================================
      29              : // class declarations
      30              : // ===========================================================================
      31              : class RONet;
      32              : class ODMatrix;
      33              : class Distribution_Points;
      34              : class ROEdge;
      35              : class ROMAEdge;
      36              : class ROVehicle;
      37              : 
      38              : 
      39              : 
      40              : // ===========================================================================
      41              : // class definitions
      42              : // ===========================================================================
      43              : /**
      44              :  * @class ROMAAssignments
      45              :  * @brief assignment methods
      46              :  *
      47              :  */
      48              : class ROMAAssignments {
      49              : public:
      50              :     /// Constructor
      51              :     ROMAAssignments(const SUMOTime begin, const SUMOTime end, const bool additiveTraffic,
      52              :                     const double adaptionFactor, const int maxAlternatives, const bool defaultCapacities,
      53              :                     RONet& net, ODMatrix& matrix, SUMOAbstractRouter<ROEdge, ROVehicle>& router,
      54              :                     OutputDevice* netloadOutput);
      55              : 
      56              :     /// Destructor
      57              :     ~ROMAAssignments();
      58              : 
      59              :     ROVehicle* getDefaultVehicle() const {
      60         1219 :         return myDefaultVehicle;
      61              :     }
      62              : 
      63              :     // @brief calculate edge capacity for the given edge
      64              :     double getCapacity(const ROEdge* edge) const;
      65              : 
      66              :     // @brief calculate edge travel time for the given edge and number of vehicles per hour
      67              :     double capacityConstraintFunction(const ROEdge* edge, const double flow) const;
      68              : 
      69              :     // @brief clear effort storage
      70              :     void resetFlows();
      71              : 
      72              :     // @brief Writes the travel times for a single interval
      73              :     void writeInterval(const SUMOTime begin, const SUMOTime end);
      74              : 
      75              :     // @brief incremental method
      76              :     void incremental(const int numIter, const bool verbose);
      77              : 
      78              :     // @brief UE method
      79              :     void ue();
      80              : 
      81              :     // @brief SUE method
      82              :     void sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const double penalty, const double tolerance, const std::string routeChoiceMethod);
      83              : 
      84              :     /** @brief Returns the effort to pass an edge including penalties
      85              :      *
      86              :      * This method is given to the used router in order to obtain the efforts
      87              :      *  to pass an edge from the internal edge weights container.
      88              :      *
      89              :      * @param[in] e The edge for which the effort to be passed shall be returned
      90              :      * @param[in] v The (default) vehicle that is routed
      91              :      * @param[in] t The time for which the effort shall be returned
      92              :      * @return The effort (time to pass in this case) for an edge
      93              :      * @see DijkstraRouter_ByProxi
      94              :      */
      95              :     static double getPenalizedEffort(const ROEdge* const e, const ROVehicle* const v, double t);
      96              : 
      97              :     /** @brief Returns the traveltime on an edge including penalties
      98              :      *
      99              :      * This method is given to the used router in order to obtain the efforts
     100              :      *  to pass an edge from the internal edge weights container.
     101              :      *
     102              :      * @param[in] e The edge for which the effort to be passed shall be returned
     103              :      * @param[in] v The (default) vehicle that is routed
     104              :      * @param[in] t The time for which the effort shall be returned
     105              :      * @return The effort (time to pass in this case) for an edge
     106              :      * @see DijkstraRouter_ByProxi
     107              :      */
     108              :     static double getPenalizedTT(const ROEdge* const e, const ROVehicle* const v, double t);
     109              : 
     110              :     /** @brief Returns the traveltime on an edge without penalties
     111              :      *
     112              :      * This method is given to the used router in order to obtain the efforts
     113              :      *  to pass an edge from the internal edge weights container.
     114              :      *
     115              :      * @param[in] e The edge for which the effort to be passed shall be returned
     116              :      * @param[in] v The (default) vehicle that is routed
     117              :      * @param[in] t The time for which the effort shall be returned
     118              :      * @return The effort (time to pass in this case) for an edge
     119              :      * @see DijkstraRouter_ByProxi
     120              :      */
     121              :     static double getTravelTime(const ROEdge* const e, const ROVehicle* const v, double t);
     122              : 
     123              : private:
     124              :     /// @brief add a route and check for duplicates
     125              :     bool addRoute(const ConstROEdgeVector& edges, std::vector<RORoute*>& paths, std::string routeId, double prob);
     126              : 
     127              :     const ConstROEdgeVector computePath(ODCell* cell, const SUMOTime time = 0, const double probability = 0., SUMOAbstractRouter<ROEdge, ROVehicle>* router = nullptr, bool setBulkMode = false);
     128              : 
     129              :     /// @brief get the k shortest paths
     130              :     void getKPaths(const int kPaths, const double penalty);
     131              : 
     132              : private:
     133              :     const SUMOTime myBegin;
     134              :     const SUMOTime myEnd;
     135              :     const bool myAdditiveTraffic;
     136              :     const double myAdaptionFactor;
     137              :     const int myMaxAlternatives;
     138              :     const bool myUseDefaultCapacities;
     139              :     RONet& myNet;
     140              :     ODMatrix& myMatrix;
     141              :     SUMOAbstractRouter<ROEdge, ROVehicle>& myRouter;
     142              :     static std::map<const ROEdge* const, double> myPenalties;
     143              :     ROVehicle* myDefaultVehicle;
     144              :     OutputDevice* const myNetloadOutput;
     145              : 
     146              : #ifdef HAVE_FOX
     147              : private:
     148              :     class RoutingTask : public MFXWorkerThread::Task {
     149              :     public:
     150              :         RoutingTask(ROMAAssignments& assign, ODCell* c, const SUMOTime begin, const double linkFlow, const bool setBulkMode = false)
     151           60 :             : myAssign(assign), myCell(c), myBegin(begin), myLinkFlow(linkFlow), mySetBulkMode(setBulkMode) {}
     152              :         void run(MFXWorkerThread* context);
     153              :     private:
     154              :         ROMAAssignments& myAssign;
     155              :         ODCell* const myCell;
     156              :         const SUMOTime myBegin;
     157              :         const double myLinkFlow;
     158              :         const bool mySetBulkMode;
     159              :     private:
     160              :         /// @brief Invalidated assignment operator.
     161              :         RoutingTask& operator=(const RoutingTask&) = delete;
     162              :     };
     163              : #endif
     164              : 
     165              : 
     166              : private:
     167              :     /// @brief Invalidated assignment operator
     168              :     ROMAAssignments& operator=(const ROMAAssignments& src) = delete;
     169              : 
     170              : };
        

Generated by: LCOV version 2.0-1