SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ODMatrix.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // An O/D (origin/destination) matrix
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2001-2013 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 "ODMatrix.h"
35 #include <utils/common/StdDefs.h>
37 #include <utils/common/ToString.h>
38 #include <iostream>
39 #include <algorithm>
40 #include <list>
41 #include <iterator>
48 #include <utils/common/SUMOTime.h>
49 
50 #ifdef CHECK_MEMORY_LEAKS
51 #include <foreign/nvwa/debug_new.h>
52 #endif // CHECK_MEMORY_LEAKS
53 
54 
55 // ===========================================================================
56 // method definitions
57 // ===========================================================================
59  : myDistricts(dc), myNoLoaded(0), myNoWritten(0), myNoDiscarded(0) {}
60 
61 
63  for (std::vector<ODCell*>::iterator i = myContainer.begin(); i != myContainer.end(); ++i) {
64  delete *i;
65  }
66  myContainer.clear();
67 }
68 
69 
70 void
71 ODMatrix::add(SUMOReal vehicleNumber, SUMOTime begin,
72  SUMOTime end, const std::string& origin, const std::string& destination,
73  const std::string& vehicleType) {
74  myNoLoaded += vehicleNumber;
75  if (myDistricts.get(origin) == 0 && myDistricts.get(destination) == 0) {
76  WRITE_WARNING("Missing origin '" + origin + "' and destination '" + destination + "' (" + toString(vehicleNumber) + " vehicles).");
77  } else if (myDistricts.get(origin) == 0 && vehicleNumber > 0) {
78  WRITE_ERROR("Missing origin '" + origin + "' (" + toString(vehicleNumber) + " vehicles).");
79  myNoDiscarded += vehicleNumber;
80  } else if (myDistricts.get(destination) == 0 && vehicleNumber > 0) {
81  WRITE_ERROR("Missing destination '" + destination + "' (" + toString(vehicleNumber) + " vehicles).");
82  myNoDiscarded += vehicleNumber;
83  } else {
84  if (myDistricts.get(origin)->sourceNumber() == 0) {
85  WRITE_ERROR("District '" + origin + "' has no source.");
86  myNoDiscarded += vehicleNumber;
87  } else if (myDistricts.get(destination)->sinkNumber() == 0) {
88  WRITE_ERROR("District '" + destination + "' has no sink.");
89  myNoDiscarded += vehicleNumber;
90  } else {
91  ODCell* cell = new ODCell();
92  cell->begin = begin;
93  cell->end = end;
94  cell->origin = origin;
95  cell->destination = destination;
96  cell->vehicleType = vehicleType;
97  cell->vehicleNumber = vehicleNumber;
98  myContainer.push_back(cell);
99  }
100  }
101 }
102 
103 
104 SUMOReal
106  size_t& vehName, std::vector<ODVehicle>& into,
107  bool uniform, const std::string& prefix) {
108  int vehicles2insert = (int) cell->vehicleNumber;
109  // compute whether the fraction forces an additional vehicle insertion
110  SUMOReal mprob = (SUMOReal) cell->vehicleNumber - (SUMOReal) vehicles2insert;
111  if (RandHelper::rand() < mprob) {
112  vehicles2insert++;
113  }
114 
115  const SUMOReal offset = (SUMOReal)(cell->end - cell->begin) / (SUMOReal) vehicles2insert / (SUMOReal) 2.;
116  for (int i = 0; i < vehicles2insert; ++i) {
117  ODVehicle veh;
118  veh.id = prefix + toString(vehName++);
119 
120  if (uniform) {
121  veh.depart = (SUMOTime)(offset + cell->begin + ((SUMOReal)(cell->end - cell->begin) * (SUMOReal) i / (SUMOReal) vehicles2insert));
122  } else {
123  veh.depart = (SUMOTime)RandHelper::rand(cell->begin, cell->end);
124  }
125 
128  veh.cell = cell;
129  into.push_back(veh);
130  }
131  return cell->vehicleNumber - vehicles2insert;
132 }
133 
134 
135 void
136 ODMatrix::writeDefaultAttrs(OutputDevice& dev, const bool noVtype,
137  const ODCell* const cell) {
138  const OptionsCont& oc = OptionsCont::getOptions();
139  if (!noVtype && cell->vehicleType != "") {
141  }
143  if (oc.isSet("departlane") && oc.getString("departlane") != "default") {
144  dev.writeAttr(SUMO_ATTR_DEPARTLANE, oc.getString("departlane"));
145  }
146  if (oc.isSet("departpos")) {
147  dev.writeAttr(SUMO_ATTR_DEPARTPOS, oc.getString("departpos"));
148  }
149  if (oc.isSet("departspeed") && oc.getString("departspeed") != "default") {
150  dev.writeAttr(SUMO_ATTR_DEPARTSPEED, oc.getString("departspeed"));
151  }
152  if (oc.isSet("arrivallane")) {
153  dev.writeAttr(SUMO_ATTR_ARRIVALLANE, oc.getString("arrivallane"));
154  }
155  if (oc.isSet("arrivalpos")) {
156  dev.writeAttr(SUMO_ATTR_ARRIVALPOS, oc.getString("arrivalpos"));
157  }
158  if (oc.isSet("arrivalspeed")) {
159  dev.writeAttr(SUMO_ATTR_ARRIVALSPEED, oc.getString("arrivalspeed"));
160  }
161 }
162 
163 
164 void
166  OutputDevice& dev, const bool uniform, const bool noVtype,
167  const std::string& prefix, const bool stepLog) {
168  if (myContainer.size() == 0) {
169  return;
170  }
171  std::map<std::pair<std::string, std::string>, SUMOReal> fractionLeft;
172  size_t vehName = 0;
173  sort(myContainer.begin(), myContainer.end(), cell_by_begin_sorter());
174  // recheck begin time
175  begin = MAX2(begin, myContainer.front()->begin);
176  std::vector<ODCell*>::iterator next = myContainer.begin();
177  std::vector<ODVehicle> vehicles;
178  SUMOTime lastOut = -DELTA_T;
179  // go through the time steps
180  for (SUMOTime t = begin; t != end;) {
181  if (stepLog && t - lastOut >= DELTA_T) {
182  std::cout << "Parsing time " + time2string(t) << '\r';
183  lastOut = t;
184  }
185  // recheck whether a new cell got valid
186  bool changed = false;
187  while (next != myContainer.end() && (*next)->begin <= t && (*next)->end > t) {
188  std::pair<std::string, std::string> odID = std::make_pair((*next)->origin, (*next)->destination);
189  // check whether the current cell must be extended by the last fraction
190  if (fractionLeft.find(odID) != fractionLeft.end()) {
191  (*next)->vehicleNumber += fractionLeft[odID];
192  fractionLeft[odID] = 0;
193  }
194  // get the new departures (into tmp)
195  const size_t oldSize = vehicles.size();
196  const SUMOReal fraction = computeDeparts(*next, vehName, vehicles, uniform, prefix);
197  if (oldSize != vehicles.size()) {
198  changed = true;
199  }
200  if (fraction != 0) {
201  fractionLeft[odID] = fraction;
202  }
203  ++next;
204  }
205  if (changed) {
206  sort(vehicles.begin(), vehicles.end(), descending_departure_comperator());
207  }
208  for (std::vector<ODVehicle>::reverse_iterator i = vehicles.rbegin(); i != vehicles.rend() && (*i).depart == t; ++i) {
209  myNoWritten++;
211  dev.writeAttr(SUMO_ATTR_FROM, (*i).from).writeAttr(SUMO_ATTR_TO, (*i).to);
212  writeDefaultAttrs(dev, noVtype, i->cell);
213  dev.closeTag();
214  }
215  while (vehicles.size() != 0 && vehicles.back().depart == t) {
216  vehicles.pop_back();
217  }
218  if (!vehicles.empty()) {
219  t = vehicles.back().depart;
220  }
221  if (next != myContainer.end() && (t > (*next)->begin || vehicles.empty())) {
222  t = (*next)->begin;
223  }
224  if (next == myContainer.end() && vehicles.empty()) {
225  break;
226  }
227  }
228 }
229 
230 
231 void
232 ODMatrix::writeFlows(const SUMOTime begin, const SUMOTime end,
233  OutputDevice& dev, bool noVtype,
234  const std::string& prefix) {
235  if (myContainer.size() == 0) {
236  return;
237  }
238  size_t flowName = 0;
239  sort(myContainer.begin(), myContainer.end(), cell_by_begin_sorter());
240  // recheck begin time
241  for (std::vector<ODCell*>::const_iterator i = myContainer.begin(); i != myContainer.end(); ++i) {
242  const ODCell* const c = *i;
243  if (c->end > begin && c->begin < end) {
244  dev.openTag(SUMO_TAG_FLOW).writeAttr(SUMO_ATTR_ID, prefix + toString(flowName++));
247  writeDefaultAttrs(dev, noVtype, *i);
248  dev.closeTag();
249  }
250  }
251 }
252 
253 
254 std::string
256  std::string line;
257  do {
258  line = lr.readLine();
259  if (line[0] != '*') {
260  return StringUtils::prune(line);
261  }
262  } while (lr.good() && lr.hasMore());
263  throw ProcessError();
264 }
265 
266 
267 SUMOTime
268 ODMatrix::parseSingleTime(const std::string& time) {
269  if (time.find('.') == std::string::npos) {
270  throw OutOfBoundsException();
271  }
272  std::string hours = time.substr(0, time.find('.'));
273  std::string minutes = time.substr(time.find('.') + 1);
274  return TIME2STEPS(TplConvert::_2int(hours.c_str()) * 3600 + TplConvert::_2int(minutes.c_str()) * 60);
275 }
276 
277 
278 std::pair<SUMOTime, SUMOTime>
280  std::string line = getNextNonCommentLine(lr);
281  try {
283  SUMOTime begin = parseSingleTime(st.next());
284  SUMOTime end = parseSingleTime(st.next());
285  if (begin >= end) {
286  throw ProcessError("Begin time is larger than end time.");
287  }
288  return std::make_pair(begin, end);
289  } catch (OutOfBoundsException&) {
290  throw ProcessError("Broken period definition '" + line + "'.");
291  } catch (NumberFormatException&) {
292  throw ProcessError("Broken period definition '" + line + "'.");
293  }
294 }
295 
296 SUMOReal
298  std::string line = getNextNonCommentLine(lr);
299  SUMOReal factor = -1;
300  try {
301  factor = TplConvert::_2SUMOReal(line.c_str()) * scale;
302  } catch (NumberFormatException&) {
303  throw ProcessError("Broken factor: '" + line + "'.");
304  }
305  return factor;
306 }
307 
308 void
310  std::string vehType, bool matrixHasVehType) {
311  PROGRESS_BEGIN_MESSAGE("Reading matrix '" + lr.getFileName() + "' stored as VMR");
312  // parse first defs
313  std::string line;
314  if (matrixHasVehType) {
315  line = getNextNonCommentLine(lr);
316  if (vehType == "") {
317  vehType = StringUtils::prune(line);
318  }
319  }
320 
321  // parse time
322  std::pair<SUMOTime, SUMOTime> times = readTime(lr);
323  SUMOTime begin = times.first;
324  SUMOTime end = times.second;
325 
326  // factor
327  SUMOReal factor = readFactor(lr, scale);
328 
329  // districts
330  line = getNextNonCommentLine(lr);
331  int districtNo = TplConvert::_2int(StringUtils::prune(line).c_str());
332  // parse district names (normally ints)
333  std::vector<std::string> names;
334  do {
335  line = getNextNonCommentLine(lr);
337  while (st2.hasNext()) {
338  names.push_back(st2.next());
339  }
340  } while ((int) names.size() != districtNo);
341 
342  // parse the cells
343  for (std::vector<std::string>::iterator si = names.begin(); si != names.end(); ++si) {
344  std::vector<std::string>::iterator di = names.begin();
345  //
346  do {
347  line = getNextNonCommentLine(lr);
348  if (line.length() == 0) {
349  continue;
350  }
351  try {
353  while (st2.hasNext()) {
354  assert(di != names.end());
355  SUMOReal vehNumber = TplConvert::_2SUMOReal(st2.next().c_str()) * factor;
356  if (vehNumber != 0) {
357  add(vehNumber, begin, end, *si, *di, vehType);
358  }
359  if (di == names.end()) {
360  throw ProcessError("More entries than districts found.");
361  }
362  ++di;
363  }
364  } catch (NumberFormatException&) {
365  throw ProcessError("Not numeric vehicle number in line '" + line + "'.");
366  }
367  if (!lr.hasMore()) {
368  break;
369  }
370  } while (di != names.end());
371  }
373 }
374 
375 
376 void
378  std::string vehType, bool matrixHasVehType) {
379  PROGRESS_BEGIN_MESSAGE("Reading matrix '" + lr.getFileName() + "' stored as OR");
380  // parse first defs
381  std::string line;
382  if (matrixHasVehType) {
383  line = getNextNonCommentLine(lr);
384  int type = TplConvert::_2int(StringUtils::prune(line).c_str());
385  if (vehType == "") {
386  vehType = toString(type);
387  }
388  }
389 
390  // parse time
391  std::pair<SUMOTime, SUMOTime> times = readTime(lr);
392  SUMOTime begin = times.first;
393  SUMOTime end = times.second;
394 
395  // factor
396  SUMOReal factor = readFactor(lr, scale);
397 
398  // parse the cells
399  while (lr.hasMore()) {
400  line = getNextNonCommentLine(lr);
401  if (line.length() == 0) {
402  continue;
403  }
405  if (st2.size() == 0) {
406  continue;
407  }
408  try {
409  std::string sourceD = st2.next();
410  std::string destD = st2.next();
411  SUMOReal vehNumber = TplConvert::_2SUMOReal(st2.next().c_str()) * factor;
412  if (vehNumber != 0) {
413  add(vehNumber, begin, end, sourceD, destD, vehType);
414  }
415  } catch (OutOfBoundsException&) {
416  throw ProcessError("Missing at least one information in line '" + line + "'.");
417  } catch (NumberFormatException&) {
418  throw ProcessError("Not numeric vehicle number in line '" + line + "'.");
419  }
420  }
422 }
423 
424 
425 
426 SUMOReal
428  return myNoLoaded;
429 }
430 
431 
432 SUMOReal
434  return myNoWritten;
435 }
436 
437 
438 SUMOReal
440  return myNoDiscarded;
441 }
442 
443 
444 void
445 ODMatrix::applyCurve(const Distribution_Points& ps, ODCell* cell, std::vector<ODCell*>& newCells) {
446  for (size_t i = 0; i < ps.getAreaNo(); ++i) {
447  ODCell* ncell = new ODCell();
448  ncell->begin = TIME2STEPS(ps.getAreaBegin(i));
449  ncell->end = TIME2STEPS(ps.getAreaEnd(i));
450  ncell->origin = cell->origin;
451  ncell->destination = cell->destination;
452  ncell->vehicleType = cell->vehicleType;
453  ncell->vehicleNumber = cell->vehicleNumber * ps.getAreaPerc(i);
454  newCells.push_back(ncell);
455  }
456 }
457 
458 
459 void
461  std::vector<ODCell*> oldCells = myContainer;
462  myContainer.clear();
463  for (std::vector<ODCell*>::iterator i = oldCells.begin(); i != oldCells.end(); ++i) {
464  std::vector<ODCell*> newCells;
465  applyCurve(ps, *i, newCells);
466  copy(newCells.begin(), newCells.end(), back_inserter(myContainer));
467  delete *i;
468  }
469 }
470 
471 void
473  std::vector<std::string> files = oc.getStringVector("od-files");
474  // check
475  if (files.size() == 0) {
476  throw ProcessError("No files to parse are given.");
477  }
478  // parse
479  for (std::vector<std::string>::iterator i = files.begin(); i != files.end(); ++i) {
480  LineReader lr(*i);
481  if (!lr.good()) {
482  throw ProcessError("Could not open '" + (*i) + "'.");
483  }
484  std::string type = lr.readLine();
485  // get the type only
486  if (type.find(';') != std::string::npos) {
487  type = type.substr(0, type.find(';'));
488  }
489  // parse type-dependant
490  if (type.length() > 1 && type[1] == 'V') {
491  // process ptv's 'V'-matrices
492  if (type.find('N') != std::string::npos) {
493  throw ProcessError("'" + *i + "' does not contain the needed information about the time described.");
494  }
495  readV(lr, oc.getFloat("scale"), oc.getString("vtype"), type.find('M') != std::string::npos);
496  } else if (type.length() > 1 && type[1] == 'O') {
497  // process ptv's 'O'-matrices
498  if (type.find('N') != std::string::npos) {
499  throw ProcessError("'" + *i + "' does not contain the needed information about the time described.");
500  }
501  readO(lr, oc.getFloat("scale"), oc.getString("vtype"), type.find('M') != std::string::npos);
502  } else {
503  throw ProcessError("'" + *i + "' uses an unknown matrix type '" + type + "'.");
504  }
505  }
506 }
507 
508 
510 ODMatrix::parseTimeLine(const std::vector<std::string>& def, bool timelineDayInHours) {
511  bool interpolating = !timelineDayInHours;
512  PositionVector points;
513  SUMOReal prob = 0;
514  if (timelineDayInHours) {
515  if (def.size() != 24) {
516  throw ProcessError("Assuming 24 entries for a day timeline, but got " + toString(def.size()) + ".");
517  }
518  for (int chour = 0; chour < 24; ++chour) {
519  prob = TplConvert::_2SUMOReal(def[chour].c_str());
520  points.push_back(Position((SUMOReal)(chour * 3600), prob));
521  }
522  points.push_back(Position((SUMOReal)(24 * 3600), prob));
523  } else {
524  size_t i = 0;
525  while (i < def.size()) {
526  StringTokenizer st2(def[i++], ":");
527  if (st2.size() != 2) {
528  throw ProcessError("Broken time line definition: missing a value in '" + def[i - 1] + "'.");
529  }
530  int time = TplConvert::_2int(st2.next().c_str());
531  prob = TplConvert::_2SUMOReal(st2.next().c_str());
532  points.push_back(Position((SUMOReal) time, prob));
533  }
534  }
535  return Distribution_Points("N/A", points, interpolating);
536 }
537 
538 /****************************************************************************/
SUMOReal getNoLoaded() const
Returns the number of loaded vehicles.
Definition: ODMatrix.cpp:427
SUMOReal myNoLoaded
Number of loaded vehicles.
Definition: ODMatrix.h:320
void writeDefaultAttrs(OutputDevice &dev, const bool noVtype, const ODCell *const cell)
Helper function for flow and trip output writing the depart and arrival attributes.
Definition: ODMatrix.cpp:136
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:254
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
Used for sorting the cells by the begin time they describe.
Definition: ODMatrix.h:333
std::string next()
bool readLine(LineHandler &lh)
Reads a single (the next) line from the file and reports it to the given LineHandler.
Definition: LineReader.cpp:80
static SUMOReal _2SUMOReal(const E *const data)
Definition: TplConvert.h:223
static const int WHITECHARS
void write(SUMOTime begin, const SUMOTime end, OutputDevice &dev, const bool uniform, const bool noVtype, const std::string &prefix, const bool stepLog)
Writes the vehicles stored in the matrix assigning the sources and sinks.
Definition: ODMatrix.cpp:165
Retrieves a file linewise and reports the lines to a handler.
Definition: LineReader.h:58
SUMOReal getAreaPerc(size_t index) const
SUMOReal myNoWritten
Number of written vehicles.
Definition: ODMatrix.h:323
const ODDistrictCont & myDistricts
The districts to retrieve sources/sinks from.
Definition: ODMatrix.h:317
SUMOReal getAreaEnd(size_t index) const
An internal representation of a single vehicle.
Definition: ODMatrix.h:227
static SUMOReal rand()
Returns a random real number in [0, 1)
Definition: RandHelper.h:61
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:61
T MAX2(T a, T b)
Definition: StdDefs.h:63
void add(SUMOReal vehicleNumber, SUMOTime begin, SUMOTime end, const std::string &origin, const std::string &destination, const std::string &vehicleType)
Builds a single cell from the given values, verifying them.
Definition: ODMatrix.cpp:71
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
#define TIME2STEPS(x)
Definition: SUMOTime.h:66
std::string from
The edge the vehicles shall start at.
Definition: ODMatrix.h:235
SUMOTime parseSingleTime(const std::string &time)
Definition: ODMatrix.cpp:268
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:196
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:67
void loadMatrix(OptionsCont &oc)
read a VISUM-matrix with the V Format
Definition: ODMatrix.cpp:472
T get(const std::string &id) const
Retrieves an item.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
unsigned int sinkNumber() const
Returns the number of sinks.
Definition: ODDistrict.cpp:81
SUMOReal getNoDiscarded() const
Returns the number of discarded vehicles.
Definition: ODMatrix.cpp:439
~ODMatrix()
Destructor.
Definition: ODMatrix.cpp:62
A single O/D-matrix cell.
Definition: ODCell.h:55
void readV(LineReader &lr, SUMOReal scale, std::string vehType, bool matrixHasVehType)
read a VISUM-matrix with the V Format
Definition: ODMatrix.cpp:309
std::string origin
Name of the origin district.
Definition: ODCell.h:66
std::string getRandomSourceFromDistrict(const std::string &name) const
Returns the id of a random source from the named district.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
A list of positions.
void readO(LineReader &lr, SUMOReal scale, std::string vehType, bool matrixHasVehType)
read a VISUM-matrix with the O Format
Definition: ODMatrix.cpp:377
ODCell * cell
The cell of the ODMatrix which generated the vehicle.
Definition: ODMatrix.h:233
A container for districts.
SUMOReal getAreaBegin(size_t index) const
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:198
unsigned int sourceNumber() const
Returns the number of sources.
Definition: ODDistrict.cpp:87
SUMOReal getNoWritten() const
Returns the number of written vehicles.
Definition: ODMatrix.cpp:433
SUMOReal vehicleNumber
The number of vehicles.
Definition: ODCell.h:57
Used for sorting vehicles by their departure (latest first)
Definition: ODMatrix.h:369
size_t size() const
SUMOReal myNoDiscarded
Number of discarded vehicles.
Definition: ODMatrix.h:326
std::vector< ODCell * > myContainer
The loaded cells.
Definition: ODMatrix.h:314
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:51
SUMOTime begin
The begin time this cell describes.
Definition: ODCell.h:60
bool good() const
Returns the information whether the stream is readable.
Definition: LineReader.cpp:229
void writeFlows(const SUMOTime begin, const SUMOTime end, OutputDevice &dev, const bool noVtype, const std::string &prefix)
Writes the flows stored in the matrix.
Definition: ODMatrix.cpp:232
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:201
SUMOReal readFactor(LineReader &lr, SUMOReal scale)
Definition: ODMatrix.cpp:297
std::string getFileName() const
Returns the name of the used file.
Definition: LineReader.cpp:183
std::pair< SUMOTime, SUMOTime > readTime(LineReader &lr)
Definition: ODMatrix.cpp:279
void push_back(const PositionVector &p)
Appends all positions from the given vector.
static int _2int(const E *const data)
Definition: TplConvert.h:114
std::string getNextNonCommentLine(LineReader &lr)
Definition: ODMatrix.cpp:255
SUMOTime depart
The departure time of the vehicle.
Definition: ODMatrix.h:231
A storage for options typed value containers)
Definition: OptionsCont.h:108
void applyCurve(const Distribution_Points &ps)
Splits the stored cells dividing them on the given time line.
Definition: ODMatrix.cpp:460
int SUMOTime
Definition: SUMOTime.h:43
std::string vehicleType
Name of the vehicle type.
Definition: ODCell.h:72
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
std::string destination
Name of the destination district.
Definition: ODCell.h:69
bool closeTag()
Closes the most recently opened tag.
#define SUMOReal
Definition: config.h:215
#define DELTA_T
Definition: SUMOTime.h:50
bool hasMore() const
Returns whether another line may be read (the file was not read completely)
Definition: LineReader.cpp:64
static std::string prune(std::string str)
Removes trailing and leading whitechars.
Definition: StringUtils.cpp:56
std::string getRandomSinkFromDistrict(const std::string &name) const
Returns the id of a random sink from the named district.
SUMOTime end
The end time this cell describes.
Definition: ODCell.h:63
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:199
std::string to
The edge the vehicles shall end at.
Definition: ODMatrix.h:237
ODMatrix(const ODDistrictCont &dc)
Constructor.
Definition: ODMatrix.cpp:58
SUMOReal computeDeparts(ODCell *cell, size_t &vehName, std::vector< ODVehicle > &into, bool uniform, const std::string &prefix)
Computes the vehicle departs stored in the given cell and saves them in &quot;into&quot;.
Definition: ODMatrix.cpp:105
std::string id
The id of the vehicle.
Definition: ODMatrix.h:229
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Distribution_Points parseTimeLine(const std::vector< std::string > &def, bool timelineDayInHours)
split the given timeline
Definition: ODMatrix.cpp:510
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.