SUMO - Simulation of Urban MObility
ROMAAssignments.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // Assignment methods
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <vector>
34 #include <router/ROEdge.h>
36 #include <router/RONet.h>
37 #include <router/RORoute.h>
39 #include <od/ODMatrix.h>
40 #include <utils/common/SUMOTime.h>
42 #include "ROMAEdge.h"
43 #include "ROMAAssignments.h"
44 
45 #ifdef CHECK_MEMORY_LEAKS
46 #include <foreign/nvwa/debug_new.h>
47 #endif // CHECK_MEMORY_LEAKS
48 
49 
50 // ===========================================================================
51 // static member variables
52 // ===========================================================================
53 std::map<const ROEdge* const, SUMOReal> ROMAAssignments::myPenalties;
54 
55 
56 // ===========================================================================
57 // method definitions
58 // ===========================================================================
59 
60 ROMAAssignments::ROMAAssignments(const SUMOTime begin, const SUMOTime end, const bool additiveTraffic,
61  const SUMOReal adaptionFactor, RONet& net, ODMatrix& matrix,
63  : myBegin(begin), myEnd(end), myAdditiveTraffic(additiveTraffic), myAdaptionFactor(adaptionFactor), myNet(net), myMatrix(matrix), myRouter(router) {
65 }
66 
67 
69  delete myDefaultVehicle;
70 }
71 
72 // based on the definitions in PTV-Validate and in the VISUM-Köln network
75  if (edge->getFunc() == ROEdge::ET_DISTRICT) {
76  return 0;
77  }
78  const int roadClass = -edge->getPriority();
79  // TODO: differ road class 1 from the unknown road class 1!!!
80  if (edge->getLaneNo() == 0) {
81  // TAZ have no cost
82  return 0;
83  } else if (roadClass == 0 || roadClass == 1) {
84  return edge->getLaneNo() * 2000.; //CR13 in table.py
85  } else if (roadClass == 2 && edge->getSpeed() <= 11.) {
86  return edge->getLaneNo() * 1333.33; //CR5 in table.py
87  } else if (roadClass == 2 && edge->getSpeed() > 11. && edge->getSpeed() <= 16.) {
88  return edge->getLaneNo() * 1500.; //CR3 in table.py
89  } else if (roadClass == 2 && edge->getSpeed() > 16.) {
90  return edge->getLaneNo() * 2000.; //CR13 in table.py
91  } else if (roadClass == 3 && edge->getSpeed() <= 11.) {
92  return edge->getLaneNo() * 800.; //CR5 in table.py
93  } else if (roadClass == 3 && edge->getSpeed() > 11. && edge->getSpeed() <= 13.) {
94  return edge->getLaneNo() * 875.; //CR5 in table.py
95  } else if (roadClass == 3 && edge->getSpeed() > 13. && edge->getSpeed() <= 16.) {
96  return edge->getLaneNo() * 1500.; //CR4 in table.py
97  } else if (roadClass == 3 && edge->getSpeed() > 16.) {
98  return edge->getLaneNo() * 1800.; //CR13 in table.py
99  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() <= 5.) {
100  return edge->getLaneNo() * 200.; //CR7 in table.py
101  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 5. && edge->getSpeed() <= 7.) {
102  return edge->getLaneNo() * 412.5; //CR7 in table.py
103  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 7. && edge->getSpeed() <= 9.) {
104  return edge->getLaneNo() * 600.; //CR6 in table.py
105  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 9. && edge->getSpeed() <= 11.) {
106  return edge->getLaneNo() * 800.; //CR5 in table.py
107  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 11. && edge->getSpeed() <= 13.) {
108  return edge->getLaneNo() * 1125.; //CR5 in table.py
109  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 13. && edge->getSpeed() <= 16.) {
110  return edge->getLaneNo() * 1583.; //CR4 in table.py
111  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 16. && edge->getSpeed() <= 18.) {
112  return edge->getLaneNo() * 1100.; //CR3 in table.py
113  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 18. && edge->getSpeed() <= 22.) {
114  return edge->getLaneNo() * 1200.; //CR3 in table.py
115  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 22. && edge->getSpeed() <= 26.) {
116  return edge->getLaneNo() * 1300.; //CR3 in table.py
117  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 26.) {
118  return edge->getLaneNo() * 1400.; //CR3 in table.py
119  }
120  return edge->getLaneNo() * 800.; //CR5 in table.py
121 }
122 
123 
124 // based on the definitions in PTV-Validate and in the VISUM-Köln network
125 SUMOReal
127  if (edge->getFunc() == ROEdge::ET_DISTRICT) {
128  return 0;
129  }
130  const int roadClass = -edge->getPriority();
131  const SUMOReal capacity = getCapacity(edge);
132  // TODO: differ road class 1 from the unknown road class 1!!!
133  if (edge->getLaneNo() == 0) {
134  // TAZ have no cost
135  return 0;
136  } else if (roadClass == 0 || roadClass == 1) {
137  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.3)) * 2.); //CR13 in table.py
138  } else if (roadClass == 2 && edge->getSpeed() <= 11.) {
139  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py
140  } else if (roadClass == 2 && edge->getSpeed() > 11. && edge->getSpeed() <= 16.) {
141  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py
142  } else if (roadClass == 2 && edge->getSpeed() > 16.) {
143  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.3)) * 2.); //CR13 in table.py
144  } else if (roadClass == 3 && edge->getSpeed() <= 11.) {
145  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py
146  } else if (roadClass == 3 && edge->getSpeed() > 11. && edge->getSpeed() <= 13.) {
147  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py
148  } else if (roadClass == 3 && edge->getSpeed() > 13. && edge->getSpeed() <= 16.) {
149  return edge->getLength() / edge->getSpeed() * (1. + 1.7 * (flow / (capacity * 1.)) * 2.); //CR4 in table.py
150  } else if (roadClass == 3 && edge->getSpeed() > 16.) {
151  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.3)) * 2.); //CR13 in table.py
152  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() <= 5.) {
153  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.5)) * 3.); //CR7 in table.py
154  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 5. && edge->getSpeed() <= 7.) {
155  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.5)) * 3.); //CR7 in table.py
156  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 7. && edge->getSpeed() <= 9.) {
157  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.8)) * 3.); //CR6 in table.py
158  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 9. && edge->getSpeed() <= 11.) {
159  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py
160  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 11. && edge->getSpeed() <= 13.) {
161  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py
162  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 13. && edge->getSpeed() <= 16.) {
163  return edge->getLength() / edge->getSpeed() * (1. + 1.7 * (flow / (capacity * 1.)) * 2.); //CR4 in table.py
164  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 16. && edge->getSpeed() <= 18.) {
165  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py
166  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 18. && edge->getSpeed() <= 22.) {
167  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py
168  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 22. && edge->getSpeed() <= 26.) {
169  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py
170  } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 26.) {
171  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py
172  }
173  return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py
174 }
175 
176 
177 bool
178 ROMAAssignments::addRoute(ConstROEdgeVector& edges, std::vector<RORoute*>& paths, std::string routeId, SUMOReal costs, SUMOReal prob) {
179  RORoute* dup = 0;
180  for (std::vector<RORoute*>::const_iterator p = paths.begin(); p != paths.end(); p++) {
181  if (edges == (*p)->getEdgeVector()) {
182  dup = *p;
183  break;
184  }
185  }
186  if (dup == 0) {
187  paths.push_back(new RORoute(routeId, costs, prob, edges, 0, std::vector<SUMOVehicleParameter::Stop>()));
188  return true;
189  }
190  dup->addProbability(prob);
191  return false;
192 }
193 
194 
195 void
196 ROMAAssignments::getKPaths(const int kPaths, const SUMOReal penalty) {
197  for (std::vector<ODCell*>::const_iterator i = myMatrix.getCells().begin(); i != myMatrix.getCells().end(); ++i) {
198  ODCell* c = *i;
199  myPenalties.clear();
200  for (int k = 0; k < kPaths; k++) {
201  ConstROEdgeVector edges;
202  myRouter.compute(myNet.getEdge(c->origin + "-source"), myNet.getEdge(c->destination + "-sink"), myDefaultVehicle, 0, edges);
203  for (ConstROEdgeVector::iterator e = edges.begin(); e != edges.end(); e++) {
204  myPenalties[*e] = penalty;
205  }
206  addRoute(edges, c->pathsVector, c->origin + c->destination + toString(c->pathsVector.size()), 0, 0);
207  }
208  }
209  myPenalties.clear();
210 }
211 
212 
213 void
215  for (std::map<std::string, ROEdge*>::const_iterator i = myNet.getEdgeMap().begin(); i != myNet.getEdgeMap().end(); ++i) {
216  ROMAEdge* edge = static_cast<ROMAEdge*>(i->second);
217  edge->setFlow(STEPS2TIME(myBegin), STEPS2TIME(myEnd), 0.);
219  }
220 }
221 
222 
223 void
224 ROMAAssignments::incremental(const int numIter) {
225  SUMOTime lastBegin = -1;
226  std::vector<int> intervals;
227  int count = 0;
228  for (std::vector<ODCell*>::const_iterator i = myMatrix.getCells().begin(); i != myMatrix.getCells().end(); ++i) {
229  if ((*i)->begin != lastBegin) {
230  intervals.push_back(count);
231  lastBegin = (*i)->begin;
232  }
233  count++;
234  }
235  lastBegin = -1;
236  for (std::vector<int>::const_iterator offset = intervals.begin(); offset != intervals.end(); offset++) {
237  std::vector<ODCell*>::const_iterator end = myMatrix.getCells().end();
238  if (offset != intervals.end() - 1) {
239  end = myMatrix.getCells().begin() + (*(offset + 1));
240  }
241  const SUMOTime intervalStart = (*(myMatrix.getCells().begin() + (*offset)))->begin;
242  std::map<const ROMAEdge*, SUMOReal> loadedTravelTimes;
243  for (std::map<std::string, ROEdge*>::const_iterator i = myNet.getEdgeMap().begin(); i != myNet.getEdgeMap().end(); ++i) {
244  ROMAEdge* edge = static_cast<ROMAEdge*>(i->second);
245  if (edge->hasLoadedTravelTime(STEPS2TIME(intervalStart))) {
246  loadedTravelTimes[edge] = edge->getTravelTime(myDefaultVehicle, STEPS2TIME(intervalStart));
247  }
248  }
249  for (int t = 0; t < numIter; t++) {
250  for (std::vector<ODCell*>::const_iterator i = myMatrix.getCells().begin() + (*offset); i != end; i++) {
251  ODCell* const c = *i;
252  ConstROEdgeVector edges;
253  const SUMOReal linkFlow = c->vehicleNumber / numIter;
254  const SUMOTime begin = myAdditiveTraffic ? myBegin : c->begin;
255  const SUMOTime end = myAdditiveTraffic ? myEnd : c->end;
256  const SUMOReal intervalLengthInHours = STEPS2TIME(end - begin) / 3600.;
257  myRouter.compute(myNet.getEdge(c->origin + "-source"), myNet.getEdge(c->destination + "-sink"), myDefaultVehicle, begin, edges);
258  SUMOReal costs = 0.;
259  for (ConstROEdgeVector::iterator e = edges.begin(); e != edges.end(); e++) {
260  ROMAEdge* edge = static_cast<ROMAEdge*>(myNet.getEdge((*e)->getID()));
261  const SUMOReal newFlow = edge->getFlow(STEPS2TIME(begin)) + linkFlow;
262  edge->setFlow(STEPS2TIME(begin), STEPS2TIME(end), newFlow);
263  SUMOReal travelTime = capacityConstraintFunction(edge, newFlow / intervalLengthInHours);
264  if (lastBegin >= 0 && myAdaptionFactor > 0.) {
265  if (loadedTravelTimes.count(edge) != 0) {
266  travelTime = loadedTravelTimes[edge] * myAdaptionFactor + (1. - myAdaptionFactor) * travelTime;
267  } else {
268  travelTime = edge->getTravelTime(myDefaultVehicle, STEPS2TIME(lastBegin)) * myAdaptionFactor + (1. - myAdaptionFactor) * travelTime;
269  }
270  }
271  edge->addTravelTime(travelTime, STEPS2TIME(begin), STEPS2TIME(end));
272  costs += travelTime;
273  }
274  addRoute(edges, c->pathsVector, c->origin + c->destination + toString(c->pathsVector.size()), costs, linkFlow);
275  }
276  }
277  lastBegin = intervalStart;
278  }
279 }
280 
281 
282 void
283 ROMAAssignments::sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const SUMOReal penalty, const SUMOReal tolerance, const std::string /* routeChoiceMethod */) {
284  getKPaths(kPaths, penalty);
285  std::map<const SUMOReal, SUMOReal> intervals;
286  if (myAdditiveTraffic) {
287  intervals[STEPS2TIME(myBegin)] = STEPS2TIME(myEnd);
288  } else {
289  for (std::vector<ODCell*>::const_iterator i = myMatrix.getCells().begin(); i != myMatrix.getCells().end(); ++i) {
290  intervals[STEPS2TIME((*i)->begin)] = STEPS2TIME((*i)->end);
291  }
292  }
293  for (int outer = 0; outer < maxOuterIteration; outer++) {
294  for (int inner = 0; inner < maxInnerIteration; inner++) {
295  for (std::vector<ODCell*>::const_iterator i = myMatrix.getCells().begin(); i != myMatrix.getCells().end(); ++i) {
296  ODCell* const c = *i;
297  const SUMOTime begin = myAdditiveTraffic ? myBegin : c->begin;
298  const SUMOTime end = myAdditiveTraffic ? myEnd : c->end;
299  // update path cost
300  for (std::vector<RORoute*>::const_iterator j = c->pathsVector.begin(); j != c->pathsVector.end(); ++j) {
301  RORoute* r = *j;
303 // std::cout << std::setprecision(20) << r->getID() << ":" << r->getCosts() << std::endl;
304  }
305  // calculate route utilities and probabilities
307  // calculate route flows
308  for (std::vector<RORoute*>::const_iterator j = c->pathsVector.begin(); j != c->pathsVector.end(); ++j) {
309  RORoute* r = *j;
310  const SUMOReal pathFlow = r->getProbability() * c->vehicleNumber;
311  // assign edge flow deltas
312  for (ConstROEdgeVector::const_iterator e = r->getEdgeVector().begin(); e != r->getEdgeVector().end(); e++) {
313  ROMAEdge* edge = static_cast<ROMAEdge*>(myNet.getEdge((*e)->getID()));
314  edge->setHelpFlow(STEPS2TIME(begin), STEPS2TIME(end), edge->getHelpFlow(STEPS2TIME(begin)) + pathFlow);
315  }
316  }
317  }
318  // calculate new edge flows and check for stability
319  int unstableEdges = 0;
320  for (std::map<const SUMOReal, SUMOReal>::const_iterator i = intervals.begin(); i != intervals.end(); ++i) {
321  const SUMOReal intervalLengthInHours = STEPS2TIME(i->second - i->first) / 3600.;
322  for (std::map<std::string, ROEdge*>::const_iterator e = myNet.getEdgeMap().begin(); e != myNet.getEdgeMap().end(); ++e) {
323  ROMAEdge* edge = static_cast<ROMAEdge*>(e->second);
324  const SUMOReal oldFlow = edge->getFlow(i->first);
325  SUMOReal newFlow = oldFlow;
326  if (inner == 0 && outer == 0) {
327  newFlow += edge->getHelpFlow(i->first);
328  } else {
329  newFlow += (edge->getHelpFlow(i->first) - oldFlow) / (inner + 1);
330  }
331  // if not lohse:
332  if (newFlow > 0.) {
333  if (abs(newFlow - oldFlow) / newFlow > tolerance) {
334  unstableEdges++;
335  }
336  } else if (newFlow == 0.) {
337  if (oldFlow != 0. && (abs(newFlow - oldFlow) / oldFlow > tolerance)) {
338  unstableEdges++;
339  }
340  } else { // newFlow < 0.
341  unstableEdges++;
342  newFlow = 0.;
343  }
344  edge->setFlow(i->first, i->second, newFlow);
345  const SUMOReal travelTime = capacityConstraintFunction(edge, newFlow / intervalLengthInHours);
346  edge->addTravelTime(travelTime, i->first, i->second);
347  edge->setHelpFlow(i->first, i->second, 0.);
348  }
349  }
350  // if stable break
351  if (unstableEdges == 0) {
352  break;
353  }
354  // additional stability check from python script: if notstable < math.ceil(net.geteffEdgeCounts()*0.005) or notstable < 3: stable = True
355  }
356  // check for a new route, if none available, break
357  // several modifications about when a route is new and when to break are in the original script
358  bool newRoute = false;
359  for (std::vector<ODCell*>::const_iterator i = myMatrix.getCells().begin(); i != myMatrix.getCells().end(); ++i) {
360  ODCell* c = *i;
361  ConstROEdgeVector edges;
362  myRouter.compute(myNet.getEdge(c->origin + "-source"), myNet.getEdge(c->destination + "-sink"), myDefaultVehicle, 0, edges);
363  newRoute |= addRoute(edges, c->pathsVector, c->origin + c->destination + toString(c->pathsVector.size()), 0, 0);
364  }
365  if (!newRoute) {
366  break;
367  }
368  }
369  // final round of assignment
370  for (std::vector<ODCell*>::const_iterator i = myMatrix.getCells().begin(); i != myMatrix.getCells().end(); ++i) {
371  ODCell* c = *i;
372  // update path cost
373  for (std::vector<RORoute*>::const_iterator j = c->pathsVector.begin(); j != c->pathsVector.end(); ++j) {
374  RORoute* r = *j;
376  }
377  // calculate route utilities and probabilities
379  // calculate route flows
380  for (std::vector<RORoute*>::const_iterator j = c->pathsVector.begin(); j != c->pathsVector.end(); ++j) {
381  RORoute* r = *j;
383  }
384  }
385 }
386 
387 
388 SUMOReal
389 ROMAAssignments::getPenalizedEffort(const ROEdge* const e, const ROVehicle* const v, SUMOReal t) {
390  const std::map<const ROEdge* const, SUMOReal>::const_iterator i = myPenalties.find(e);
391  return i == myPenalties.end() ? e->getEffort(v, t) : e->getEffort(v, t) + i->second;
392 }
393 
394 
395 SUMOReal
396 ROMAAssignments::getPenalizedTT(const ROEdge* const e, const ROVehicle* const v, SUMOReal t) {
397  const std::map<const ROEdge* const, SUMOReal>::const_iterator i = myPenalties.find(e);
398  return i == myPenalties.end() ? e->getTravelTime(v, t) : e->getTravelTime(v, t) + i->second;
399 }
400 
401 
402 SUMOReal
403 ROMAAssignments::getTravelTime(const ROEdge* const e, const ROVehicle* const v, SUMOReal t) {
404  return e->getTravelTime(v, t);
405 }
void incremental(const int numIter)
const std::vector< ODCell * > & getCells()
Definition: ODMatrix.h:242
SUMOAbstractRouter< ROEdge, ROVehicle > & myRouter
long long int SUMOTime
Definition: SUMOTime.h:43
SUMOReal getFlow(const SUMOReal time) const
Definition: ROMAEdge.h:93
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
Definition: RONet.h:158
ROMAAssignments(const SUMOTime begin, const SUMOTime end, const bool additiveTraffic, const SUMOReal adaptionFactor, RONet &net, ODMatrix &matrix, SUMOAbstractRouter< ROEdge, ROVehicle > &router)
Constructor.
const SUMOTime myBegin
const ConstROEdgeVector & getEdgeVector() const
Returns the list of edges this route consists of.
Definition: RORoute.h:155
void setProbability(SUMOReal prob)
Sets the probability of the route.
Definition: RORoute.cpp:80
EdgeFunc getFunc() const
Returns the function of the edge.
Definition: ROEdge.h:186
void setFlow(const SUMOReal begin, const SUMOReal end, const SUMOReal flow)
Definition: ROMAEdge.h:89
unsigned int getLaneNo() const
Returns the number of lanes this edge has.
Definition: ROEdge.h:217
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:59
std::vector< RORoute * > pathsVector
the list of paths / routes
Definition: ODCell.h:78
const bool myAdditiveTraffic
const std::string DEFAULT_VTYPE_ID
void addTravelTime(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd)
Adds a travel time value.
Definition: ROEdge.cpp:126
#define abs(a)
Definition: polyfonts.c:67
const std::map< std::string, ROEdge * > & getEdgeMap() const
Definition: RONet.cpp:630
const SUMOTime myEnd
void addProbability(SUMOReal prob)
add additional vehicles/probability
Definition: RORoute.cpp:91
bool hasLoadedTravelTime(SUMOReal time) const
Returns whether a travel time for this edge was loaded.
Definition: ROEdge.cpp:154
A vehicle as used by router.
Definition: ROVehicle.h:60
A single O/D-matrix cell.
Definition: ODCell.h:58
void setHelpFlow(const SUMOReal begin, const SUMOReal end, const SUMOReal flow)
Definition: ROMAEdge.h:97
std::string origin
Name of the origin district.
Definition: ODCell.h:69
static SUMOReal getPenalizedTT(const ROEdge *const e, const ROVehicle *const v, SUMOReal t)
Returns the traveltime on an edge including penalties.
void sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const SUMOReal penalty, const SUMOReal tolerance, const std::string routeChoiceMethod)
An O/D (origin/destination) matrix.
Definition: ODMatrix.h:75
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
SUMOReal getProbability() const
Returns the probability the driver will take this route with.
Definition: RORoute.h:123
void setCosts(SUMOReal costs)
Sets the costs of the route.
Definition: RORoute.cpp:74
~ROMAAssignments()
Destructor.
SUMOReal vehicleNumber
The number of vehicles.
Definition: ODCell.h:60
static std::map< const ROEdge *const, SUMOReal > myPenalties
static SUMOReal getTravelTime(const ROEdge *const e, const ROVehicle *const v, SUMOReal t)
Returns the traveltime on an edge without penalties.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:53
static SUMOReal getPenalizedEffort(const ROEdge *const e, const ROVehicle *const v, SUMOReal t)
Returns the effort to pass an edge including penalties.
SUMOTime begin
The begin time this cell describes.
Definition: ODCell.h:63
A basic edge for routing applications.
Definition: ROEdge.h:73
SUMOReal getHelpFlow(const SUMOReal time) const
Definition: ROMAEdge.h:101
static SUMOReal getCapacity(const ROEdge *edge)
The router&#39;s network representation.
Definition: RONet.h:72
Structure representing possible vehicle parameter.
int getPriority() const
get edge priority (road class)
Definition: ROEdge.h:417
SUMOReal getLength() const
Returns the length of the edge.
Definition: ROEdge.h:194
ROVehicle * myDefaultVehicle
SUMOReal getEffort(const ROVehicle *const veh, SUMOReal time) const
Returns the effort for this edge.
Definition: ROEdge.cpp:133
void getKPaths(const int kPaths, const SUMOReal penalty)
get the k shortest paths
virtual SUMOReal recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime) const =0
std::string destination
Name of the destination district.
Definition: ODCell.h:72
bool addRoute(ConstROEdgeVector &edges, std::vector< RORoute * > &paths, std::string routeId, SUMOReal costs, SUMOReal prob)
add a route and check for duplicates
#define SUMOReal
Definition: config.h:214
virtual void compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
Definition: RONet.cpp:252
SUMOReal getTravelTime(const ROVehicle *const veh, SUMOReal time) const
Returns the travel time for this edge.
Definition: ROEdge.cpp:160
static RouteCostCalculator< R, E, V > & getCalculator()
SUMOTime end
The end time this cell describes.
Definition: ODCell.h:66
An edge representing a whole district.
Definition: ROEdge.h:83
SUMOReal capacityConstraintFunction(const ROEdge *edge, const SUMOReal flow) const
A basic edge for routing applications.
Definition: ROMAEdge.h:65
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
Definition: ROEdge.h:209
A complete router&#39;s route.
Definition: RORoute.h:62
const SUMOReal myAdaptionFactor
ODMatrix & myMatrix