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-2020 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 /****************************************************************************/
20 // Assignment methods
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
26 #include <utils/common/SUMOTime.h>
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
31 class RONet;
32 class ODMatrix;
34 class ROEdge;
35 class ROMAEdge;
36 class ROVehicle;
37 
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
49 public:
51  ROMAAssignments(const SUMOTime begin, const SUMOTime end, const bool additiveTraffic,
52  const double adaptionFactor, const int maxAlternatives,
54 
57 
59  return myDefaultVehicle;
60  }
61 
62  // @brief calculate edge capacity for the given edge
63  static double getCapacity(const ROEdge* edge);
64 
65  // @brief calculate edge travel time for the given edge and number of vehicles per hour
66  double capacityConstraintFunction(const ROEdge* edge, const double flow) const;
67 
68  // @brief clear effort storage
69  void resetFlows();
70 
71  // @brief incremental method
72  void incremental(const int numIter, const bool verbose);
73 
74  // @brief UE method
75  void ue();
76 
77  // @brief SUE method
78  void sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const double penalty, const double tolerance, const std::string routeChoiceMethod);
79 
91  static double getPenalizedEffort(const ROEdge* const e, const ROVehicle* const v, double t);
92 
104  static double getPenalizedTT(const ROEdge* const e, const ROVehicle* const v, double t);
105 
117  static double getTravelTime(const ROEdge* const e, const ROVehicle* const v, double t);
118 
119 private:
121  bool addRoute(const ConstROEdgeVector& edges, std::vector<RORoute*>& paths, std::string routeId, double prob);
122 
123  const ConstROEdgeVector computePath(ODCell* cell, const SUMOTime time = 0, const double probability = 0., SUMOAbstractRouter<ROEdge, ROVehicle>* router = nullptr);
124 
126  void getKPaths(const int kPaths, const double penalty);
127 
128 private:
131  const bool myAdditiveTraffic;
132  const double myAdaptionFactor;
133  const int myMaxAlternatives;
137  static std::map<const ROEdge* const, double> myPenalties;
139 
140 #ifdef HAVE_FOX
141 private:
142  class RoutingTask : public FXWorkerThread::Task {
143  public:
144  RoutingTask(ROMAAssignments& assign, ODCell* c, const SUMOTime begin, const double linkFlow)
145  : myAssign(assign), myCell(c), myBegin(begin), myLinkFlow(linkFlow) {}
146  void run(FXWorkerThread* context);
147  private:
148  ROMAAssignments& myAssign;
149  ODCell* const myCell;
150  const SUMOTime myBegin;
151  const double myLinkFlow;
152  private:
154  RoutingTask& operator=(const RoutingTask&);
155  };
156 #endif
157 
158 
159 private:
162 
163 };
164 
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:54
long long int SUMOTime
Definition: SUMOTime.h:31
Abstract superclass of a task to be run with an index to keep track of pending tasks.
A thread repeatingly calculating incoming tasks.
An O/D (origin/destination) matrix.
Definition: ODMatrix.h:67
A basic edge for routing applications.
Definition: ROEdge.h:70
assignment methods
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.
ROMAAssignments & operator=(const ROMAAssignments &src)
Invalidated assignment operator.
const double myAdaptionFactor
ODMatrix & myMatrix
void sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const double penalty, const double tolerance, const std::string routeChoiceMethod)
void getKPaths(const int kPaths, const double penalty)
get the k shortest paths
ROVehicle * getDefaultVehicle()
static double getPenalizedEffort(const ROEdge *const e, const ROVehicle *const v, double t)
Returns the effort to pass an edge including penalties.
void incremental(const int numIter, const bool verbose)
double capacityConstraintFunction(const ROEdge *edge, const double flow) const
const bool myAdditiveTraffic
static double getCapacity(const ROEdge *edge)
const int myMaxAlternatives
ROVehicle * myDefaultVehicle
const SUMOTime myEnd
static double getPenalizedTT(const ROEdge *const e, const ROVehicle *const v, double t)
Returns the traveltime on an edge including penalties.
static double getTravelTime(const ROEdge *const e, const ROVehicle *const v, double t)
Returns the traveltime on an edge without penalties.
static std::map< const ROEdge *const, double > myPenalties
SUMOAbstractRouter< ROEdge, ROVehicle > & myRouter
bool addRoute(const ConstROEdgeVector &edges, std::vector< RORoute * > &paths, std::string routeId, double prob)
add a route and check for duplicates
const SUMOTime myBegin
const ConstROEdgeVector computePath(ODCell *cell, const SUMOTime time=0, const double probability=0., SUMOAbstractRouter< ROEdge, ROVehicle > *router=nullptr)
~ROMAAssignments()
Destructor.
A basic edge for routing applications.
Definition: ROMAEdge.h:55
The router's network representation.
Definition: RONet.h:62
A vehicle as used by router.
Definition: ROVehicle.h:50
A single O/D-matrix cell.
Definition: ODCell.h:48