Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
ROMAAssignments.h
Go to the documentation of this file.
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/****************************************************************************/
20// Assignment methods
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
27
28// ===========================================================================
29// class declarations
30// ===========================================================================
31class RONet;
32class ODMatrix;
34class ROEdge;
35class ROMAEdge;
36class ROVehicle;
37
38
39
40// ===========================================================================
41// class definitions
42// ===========================================================================
49public:
51 ROMAAssignments(const SUMOTime begin, const SUMOTime end, const bool additiveTraffic,
52 const double adaptionFactor, const int maxAlternatives, const bool defaultCapacities,
54 OutputDevice* netloadOutput);
55
58
60 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
95 static double getPenalizedEffort(const ROEdge* const e, const ROVehicle* const v, double t);
96
108 static double getPenalizedTT(const ROEdge* const e, const ROVehicle* const v, double t);
109
121 static double getTravelTime(const ROEdge* const e, const ROVehicle* const v, double t);
122
123private:
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
130 void getKPaths(const int kPaths, const double penalty);
131
132private:
136 const double myAdaptionFactor;
142 static std::map<const ROEdge* const, double> myPenalties;
145
146#ifdef HAVE_FOX
147private:
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 : 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:
161 RoutingTask& operator=(const RoutingTask&) = delete;
162 };
163#endif
164
165
166private:
169
170};
long long int SUMOTime
Definition GUI.h:36
std::vector< const ROEdge * > ConstROEdgeVector
Definition ROEdge.h:56
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:68
Static storage of an output device and its base (abstract) implementation.
A basic edge for routing applications.
Definition ROEdge.h:72
assignment methods
ROVehicle * getDefaultVehicle() const
const ConstROEdgeVector computePath(ODCell *cell, const SUMOTime time=0, const double probability=0., SUMOAbstractRouter< ROEdge, ROVehicle > *router=nullptr, bool setBulkMode=false)
ROMAAssignments & operator=(const ROMAAssignments &src)=delete
Invalidated assignment operator.
const double myAdaptionFactor
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
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
double getCapacity(const ROEdge *edge) const
const bool myAdditiveTraffic
const int myMaxAlternatives
void writeInterval(const SUMOTime begin, const SUMOTime end)
ROVehicle * myDefaultVehicle
const SUMOTime myEnd
OutputDevice *const myNetloadOutput
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
const bool myUseDefaultCapacities
bool addRoute(const ConstROEdgeVector &edges, std::vector< RORoute * > &paths, std::string routeId, double prob)
add a route and check for duplicates
const SUMOTime myBegin
~ROMAAssignments()
Destructor.
A basic edge for routing applications.
Definition ROMAEdge.h:55
The router's network representation.
Definition RONet.h:63
A vehicle as used by router.
Definition ROVehicle.h:50
A single O/D-matrix cell.
Definition ODCell.h:49