Eclipse SUMO - Simulation of Urban MObility
ROMAAssignments.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // Assignment methods
18 /****************************************************************************/
19 #ifndef ROMAAssignments_h
20 #define ROMAAssignments_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
29 #include <utils/common/SUMOTime.h>
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class RONet;
35 class ODMatrix;
37 class ROEdge;
38 class ROMAEdge;
39 class ROVehicle;
40 
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
52 public:
54  ROMAAssignments(const SUMOTime begin, const SUMOTime end, const bool additiveTraffic,
55  const double adaptionFactor, const int maxAlternatives,
57 
60 
62  return myDefaultVehicle;
63  }
64 
65  // @brief calculate edge capacity for the given edge
66  static double getCapacity(const ROEdge* edge);
67 
68  // @brief calculate edge travel time for the given edge and number of vehicles per hour
69  double capacityConstraintFunction(const ROEdge* edge, const double flow) const;
70 
71  // @brief clear effort storage
72  void resetFlows();
73 
74  // @brief incremental method
75  void incremental(const int numIter, const bool verbose);
76 
77  // @brief UE method
78  void ue();
79 
80  // @brief SUE method
81  void sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const double penalty, const double tolerance, const std::string routeChoiceMethod);
82 
94  static double getPenalizedEffort(const ROEdge* const e, const ROVehicle* const v, double t);
95 
107  static double getPenalizedTT(const ROEdge* const e, const ROVehicle* const v, double t);
108 
120  static double getTravelTime(const ROEdge* const e, const ROVehicle* const v, double t);
121 
122 private:
124  bool addRoute(const ConstROEdgeVector& edges, std::vector<RORoute*>& paths, std::string routeId, double prob);
125 
126  const ConstROEdgeVector computePath(ODCell* cell, const SUMOTime time = 0, const double probability = 0., SUMOAbstractRouter<ROEdge, ROVehicle>* router = nullptr);
127 
129  void getKPaths(const int kPaths, const double penalty);
130 
131 private:
134  const bool myAdditiveTraffic;
135  const double myAdaptionFactor;
136  const int myMaxAlternatives;
140  static std::map<const ROEdge* const, double> myPenalties;
142 
143 #ifdef HAVE_FOX
144 private:
145  class RoutingTask : public FXWorkerThread::Task {
146  public:
147  RoutingTask(ROMAAssignments& assign, ODCell* c, const SUMOTime begin, const double linkFlow)
148  : myAssign(assign), myCell(c), myBegin(begin), myLinkFlow(linkFlow) {}
149  void run(FXWorkerThread* context);
150  private:
151  ROMAAssignments& myAssign;
152  ODCell* const myCell;
153  const SUMOTime myBegin;
154  const double myLinkFlow;
155  private:
157  RoutingTask& operator=(const RoutingTask&);
158  };
159 #endif
160 
161 
162 private:
165 
166 };
167 
168 #endif
SUMOAbstractRouter< ROEdge, ROVehicle > & myRouter
long long int SUMOTime
Definition: SUMOTime.h:35
void getKPaths(const int kPaths, const double penalty)
get the k shortest paths
assignment methods
void incremental(const int numIter, const bool verbose)
const SUMOTime myBegin
static std::map< const ROEdge *const, double > myPenalties
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:57
const bool myAdditiveTraffic
const double myAdaptionFactor
const SUMOTime myEnd
A vehicle as used by router.
Definition: ROVehicle.h:53
A single O/D-matrix cell.
Definition: ODCell.h:51
ROMAAssignments(const SUMOTime begin, const SUMOTime end, const bool additiveTraffic, const double adaptionFactor, const int maxAlternatives, RONet &net, ODMatrix &matrix, SUMOAbstractRouter< ROEdge, ROVehicle > &router)
Constructor.
An O/D (origin/destination) matrix.
Definition: ODMatrix.h:69
~ROMAAssignments()
Destructor.
static double getCapacity(const ROEdge *edge)
A basic edge for routing applications.
Definition: ROEdge.h:73
double capacityConstraintFunction(const ROEdge *edge, const double flow) const
static double getPenalizedEffort(const ROEdge *const e, const ROVehicle *const v, double t)
Returns the effort to pass an edge including penalties.
The router&#39;s network representation.
Definition: RONet.h:64
static double getTravelTime(const ROEdge *const e, const ROVehicle *const v, double t)
Returns the traveltime on an edge without penalties.
ROVehicle * myDefaultVehicle
ROMAAssignments & operator=(const ROMAAssignments &src)
Invalidated assignment operator.
const int myMaxAlternatives
bool addRoute(const ConstROEdgeVector &edges, std::vector< RORoute *> &paths, std::string routeId, double prob)
add a route and check for duplicates
Abstract superclass of a task to be run with an index to keep track of pending tasks.
A thread repeatingly calculating incoming tasks.
void sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const double penalty, const double tolerance, const std::string routeChoiceMethod)
const ConstROEdgeVector computePath(ODCell *cell, const SUMOTime time=0, const double probability=0., SUMOAbstractRouter< ROEdge, ROVehicle > *router=nullptr)
ROVehicle * getDefaultVehicle()
A basic edge for routing applications.
Definition: ROMAEdge.h:58
static double getPenalizedTT(const ROEdge *const e, const ROVehicle *const v, double t)
Returns the traveltime on an edge including penalties.
ODMatrix & myMatrix