Eclipse SUMO - Simulation of Urban MObility
ROPerson.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-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 /****************************************************************************/
21 // A vehicle as used by router
22 /****************************************************************************/
23 #include <config.h>
24 
25 #include <string>
26 #include <iostream>
28 #include <utils/common/ToString.h>
35 #include "RORouteDef.h"
36 #include "RORoute.h"
37 #include "ROVehicle.h"
38 #include "ROHelper.h"
39 #include "RONet.h"
40 #include "ROLane.h"
41 #include "ROPerson.h"
42 
43 
44 // ===========================================================================
45 // method definitions
46 // ===========================================================================
48  : RORoutable(pars, type) {
49 }
50 
51 
53  for (std::vector<PlanItem*>::const_iterator it = myPlan.begin(); it != myPlan.end(); ++it) {
54  delete *it;
55  }
56 }
57 
58 
59 void
60 ROPerson::addTrip(const ROEdge* const from, const ROEdge* const to, const SVCPermissions modeSet,
61  const std::string& vTypes, const double departPos, const double arrivalPos,
62  const std::string& busStop, double walkFactor, const std::string& group) {
63  PersonTrip* trip = new PersonTrip(from, to, modeSet, departPos, arrivalPos, busStop, walkFactor, group);
64  RONet* net = RONet::getInstance();
67  if (departPos != 0) {
69  pars.departPos = departPos;
71  }
72  for (StringTokenizer st(vTypes); st.hasNext();) {
73  pars.vtypeid = st.next();
76  if (type == nullptr) {
77  delete trip;
78  throw InvalidArgument("The vehicle type '" + pars.vtypeid + "' in a trip for person '" + getID() + "' is not known.");
79  }
80  pars.id = getID() + "_" + toString(trip->getVehicles().size());
81  trip->addVehicle(new ROVehicle(pars, new RORouteDef("!" + pars.id, 0, false, false), type, net));
82  // update modeset with routing-category vClass
83  if (type->vehicleClass == SVC_BICYCLE) {
84  trip->updateMOdes(SVC_BICYCLE);
85  } else {
87  }
88  }
89  if (trip->getVehicles().empty()) {
90  if ((modeSet & SVC_PASSENGER) != 0) {
91  pars.id = getID() + "_0";
92  trip->addVehicle(new ROVehicle(pars, new RORouteDef("!" + pars.id, 0, false, false), net->getVehicleTypeSecure(DEFAULT_VTYPE_ID), net));
93  }
94  if ((modeSet & SVC_BICYCLE) != 0) {
95  pars.id = getID() + "_b0";
98  trip->addVehicle(new ROVehicle(pars, new RORouteDef("!" + pars.id, 0, false, false), net->getVehicleTypeSecure(DEFAULT_BIKETYPE_ID), net));
99  }
100  if ((modeSet & SVC_TAXI) != 0) {
101  // add dummy taxi for routing (never added to output)
102  pars.id = "taxi"; // id is writen as 'line'
104  trip->addVehicle(new ROVehicle(pars, new RORouteDef("!" + pars.id, 0, false, false), net->getVehicleTypeSecure(DEFAULT_TAXITYPE_ID), net));
105  }
106  }
107  myPlan.push_back(trip);
108 }
109 
110 
111 void
112 ROPerson::addRide(const ROEdge* const from, const ROEdge* const to, const std::string& lines,
113  double arrivalPos, const std::string& destStop, const std::string& group) {
114  if (myPlan.empty() || myPlan.back()->isStop()) {
115  myPlan.push_back(new PersonTrip());
116  }
117  myPlan.back()->addTripItem(new Ride(from, to, lines, group, -1., arrivalPos, destStop));
118 }
119 
120 
121 void
122 ROPerson::addWalk(const ConstROEdgeVector& edges, const double duration, const double speed, const double departPos, const double arrivalPos, const std::string& busStop) {
123  if (myPlan.empty() || myPlan.back()->isStop()) {
124  myPlan.push_back(new PersonTrip());
125  }
126  myPlan.back()->addTripItem(new Walk(edges, -1., duration, speed, departPos, arrivalPos, busStop));
127 }
128 
129 
130 void
131 ROPerson::addStop(const SUMOVehicleParameter::Stop& stopPar, const ROEdge* const stopEdge) {
132  myPlan.push_back(new Stop(stopPar, stopEdge));
133 }
134 
135 
136 void
137 ROPerson::Ride::saveAsXML(OutputDevice& os, const bool extended) const {
139  std::string comment = "";
140  if (extended && cost >= 0.) {
142  }
143  if (from != nullptr) {
145  }
146  if (to != nullptr) {
147  os.writeAttr(SUMO_ATTR_TO, to->getID());
148  }
149  if (destStop != "") {
151  const std::string name = RONet::getInstance()->getStoppingPlaceName(destStop);
152  if (name != "") {
153  comment = " <!-- " + name + " -->";
154  }
155  } else if (arr != 0 && arr != std::numeric_limits<double>::infinity()) {
157  }
159  if (group != "") {
161  }
162  if (intended != "" && intended != lines) {
164  }
165  if (depart >= 0) {
167  }
168  os.closeTag(comment);
169 }
170 
171 
172 void
173 ROPerson::Walk::saveAsXML(OutputDevice& os, const bool extended) const {
175  std::string comment = "";
176  if (extended && cost >= 0.) {
177  os.writeAttr(SUMO_ATTR_COST, cost);
178  }
179  if (dur > 0) {
180  os.writeAttr(SUMO_ATTR_DURATION, dur);
181  }
182  if (v > 0) {
183  os.writeAttr(SUMO_ATTR_SPEED, v);
184  }
185  os.writeAttr(SUMO_ATTR_EDGES, edges);
186  if (destStop != "") {
187  os.writeAttr(SUMO_ATTR_BUS_STOP, destStop);
188  const std::string name = RONet::getInstance()->getStoppingPlaceName(destStop);
189  if (name != "") {
190  comment = " <!-- " + name + " -->";
191  }
192  } else if (arr != 0 && arr != std::numeric_limits<double>::infinity()) {
194  }
195  os.closeTag(comment);
196 }
197 
200  PersonTrip* result = new PersonTrip(from, to, modes, dep, arr, stopDest, walkFactor, group);
201  for (auto* item : myTripItems) {
202  result->myTripItems.push_back(item->clone());
203  }
204  return result;
205 }
206 
207 void
208 ROPerson::PersonTrip::saveVehicles(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const {
209  for (ROVehicle* veh : myVehicles) {
210  if (!RONet::getInstance()->knowsVehicle(veh->getID())) {
211  veh->saveAsXML(os, typeos, asAlternatives, options);
212  }
213  }
214 }
215 
216 void
217 ROPerson::PersonTrip::saveAsXML(OutputDevice& os, const bool extended, const bool asTrip, const bool writeGeoTrip) const {
218  if ((asTrip || extended) && from != nullptr) {
220  if (writeGeoTrip) {
221  Position fromPos = from->getLanes()[0]->getShape().positionAtOffset2D(getDepartPos());
222  if (GeoConvHelper::getFinal().usingGeoProjection()) {
225  os.writeAttr(SUMO_ATTR_FROMLONLAT, fromPos);
227  } else {
228  os.writeAttr(SUMO_ATTR_FROMXY, fromPos);
229  }
230  } else {
231  os.writeAttr(SUMO_ATTR_FROM, from->getID());
232  }
233  if (writeGeoTrip) {
234  Position toPos = to->getLanes()[0]->getShape().positionAtOffset2D(MIN2(getArrivalPos(), to->getLanes()[0]->getShape().length2D()));
235  if (GeoConvHelper::getFinal().usingGeoProjection()) {
238  os.writeAttr(SUMO_ATTR_TOLONLAT, toPos);
240  } else {
241  os.writeAttr(SUMO_ATTR_TOXY, toPos);
242  }
243  } else {
244  os.writeAttr(SUMO_ATTR_TO, to->getID());
245  }
246  std::vector<std::string> allowedModes;
247  if ((modes & SVC_BUS) != 0) {
248  allowedModes.push_back("public");
249  }
250  if ((modes & SVC_PASSENGER) != 0) {
251  allowedModes.push_back("car");
252  }
253  if ((modes & SVC_TAXI) != 0) {
254  allowedModes.push_back("taxi");
255  }
256  if ((modes & SVC_BICYCLE) != 0) {
257  allowedModes.push_back("bicycle");
258  }
259  if (allowedModes.size() > 0) {
260  os.writeAttr(SUMO_ATTR_MODES, toString(allowedModes));
261  }
262  if (!writeGeoTrip) {
263  if (dep != 0 && dep != std::numeric_limits<double>::infinity()) {
265  }
266  if (arr != 0 && arr != std::numeric_limits<double>::infinity()) {
268  }
269  }
270  if (getStopDest() != "") {
271  os.writeAttr(SUMO_ATTR_BUS_STOP, getStopDest());
272  }
273  if (walkFactor != 1) {
274  os.writeAttr(SUMO_ATTR_WALKFACTOR, walkFactor);
275  }
276  if (extended && myTripItems.size() != 0) {
277  std::vector<double> costs;
278  for (TripItem* tripItem : myTripItems) {
279  costs.push_back(tripItem->getCost());
280  }
281  os.writeAttr(SUMO_ATTR_COSTS, costs);
282  }
283  os.closeTag();
284  } else {
285  for (std::vector<TripItem*>::const_iterator it = myTripItems.begin(); it != myTripItems.end(); ++it) {
286  (*it)->saveAsXML(os, extended);
287  }
288  }
289 }
290 
291 SUMOTime
293  SUMOTime result = 0;
294  for (TripItem* tItem : myTripItems) {
295  result += tItem->getDuration();
296  }
297  return result;
298 }
299 
300 bool
302  PersonTrip* const trip, const ROVehicle* const veh, MsgHandler* const errorHandler) {
303  std::vector<ROIntermodalRouter::TripItem> result;
304  provider.getIntermodalRouter().compute(trip->getOrigin(), trip->getDestination(), trip->getDepartPos(), trip->getArrivalPos(), trip->getStopDest(),
305  getType()->maxSpeed * trip->getWalkFactor(), veh, trip->getModes(), time, result);
306  bool carUsed = false;
307  for (std::vector<ROIntermodalRouter::TripItem>::const_iterator it = result.begin(); it != result.end(); ++it) {
308  const auto& item = *it;
309  if (!item.edges.empty()) {
310  if (item.line == "") {
311  double depPos = trip->getDepartPos(false);
312  double arrPos = trip->getArrivalPos(false);
313  if (trip->getOrigin()->isTazConnector()) {
314  // walk the whole length of the first edge
315  const ROEdge* first = item.edges.front();
316  if (std::find(first->getPredecessors().begin(), first->getPredecessors().end(), trip->getOrigin()) != first->getPredecessors().end()) {
317  depPos = 0;
318  } else {
319  depPos = first->getLength();
320  }
321  }
322  if (trip->getDestination()->isTazConnector()) {
323  // walk the whole length of the last edge
324  const ROEdge* last = item.edges.back();
325  if (std::find(last->getSuccessors().begin(), last->getSuccessors().end(), trip->getDestination()) != last->getSuccessors().end()) {
326  arrPos = last->getLength();
327  } else {
328  arrPos = 0;
329  }
330  }
331  if (it + 1 == result.end() && trip->getStopDest() == "") {
332  trip->addTripItem(new Walk(item.edges, item.cost, depPos, arrPos));
333  } else {
334  trip->addTripItem(new Walk(item.edges, item.cost, depPos, arrPos, item.destStop));
335  }
336  } else if (veh != nullptr && item.line == veh->getID()) {
337  trip->addTripItem(new Ride(item.edges.front(), item.edges.back(), veh->getID(), trip->getGroup(), item.cost, item.arrivalPos, item.destStop));
338  if (veh->getVClass() != SVC_TAXI) {
339  RORoute* route = new RORoute(veh->getID() + "_RouteDef", item.edges);
340  route->setProbability(1);
342  carUsed = true;
343  }
344  } else {
345  trip->addTripItem(new Ride(nullptr, nullptr, item.line, trip->getGroup(), item.cost, item.arrivalPos, item.destStop, item.intended, TIME2STEPS(item.depart)));
346  }
347  }
348  }
349  if (result.empty()) {
350  errorHandler->inform("No route for trip in person '" + getID() + "'.");
351  myRoutingSuccess = false;
352  }
353  return carUsed;
354 }
355 
356 
357 void
359  const bool /* removeLoops */, MsgHandler* errorHandler) {
360  myRoutingSuccess = true;
361  SUMOTime time = getParameter().depart;
362  for (std::vector<PlanItem*>::iterator it = myPlan.begin(); it != myPlan.end(); ++it) {
363  if ((*it)->needsRouting()) {
364  PersonTrip* trip = static_cast<PersonTrip*>(*it);
365  std::vector<ROVehicle*>& vehicles = trip->getVehicles();
366  if (vehicles.empty()) {
367  computeIntermodal(time, provider, trip, nullptr, errorHandler);
368  } else {
369  for (std::vector<ROVehicle*>::iterator v = vehicles.begin(); v != vehicles.end();) {
370  if (!computeIntermodal(time, provider, trip, *v, errorHandler)) {
371  v = vehicles.erase(v);
372  } else {
373  ++v;
374  }
375  }
376  }
377  }
378  time += (*it)->getDuration();
379  }
380 }
381 
382 
383 void
384 ROPerson::saveAsXML(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const {
385  // write the person's vehicles
386  const bool writeTrip = options.exists("write-trips") && options.getBool("write-trips");
387  const bool writeGeoTrip = writeTrip && options.getBool("write-trips.geo");
388  if (!writeTrip) {
389  for (std::vector<PlanItem*>::const_iterator it = myPlan.begin(); it != myPlan.end(); ++it) {
390  (*it)->saveVehicles(os, typeos, asAlternatives, options);
391  }
392  }
393 
394  if (typeos != nullptr && getType() != nullptr && !getType()->saved) {
395  getType()->write(*typeos);
396  getType()->saved = true;
397  }
398  if (getType() != nullptr && !getType()->saved) {
399  getType()->write(os);
400  getType()->saved = asAlternatives;
401  }
402 
403  // write the person
404  getParameter().write(os, options, SUMO_TAG_PERSON);
405 
406  for (std::vector<PlanItem*>::const_iterator it = myPlan.begin(); it != myPlan.end(); ++it) {
407  (*it)->saveAsXML(os, asAlternatives, writeTrip, writeGeoTrip);
408  }
409 
410  // write params
412  os.closeTag();
413 }
414 
415 
416 /****************************************************************************/
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:54
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
#define TIME2STEPS(x)
Definition: SUMOTime.h:55
long long int SUMOTime
Definition: SUMOTime.h:31
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
const std::string DEFAULT_TAXITYPE_ID
const std::string DEFAULT_VTYPE_ID
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::string DEFAULT_BIKETYPE_ID
@ GIVEN
The position is given.
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_VTYPE_SET
@ DEPART_TRIGGERED
The departure is person triggered.
@ SUMO_TAG_WALK
@ SUMO_TAG_RIDE
@ SUMO_TAG_PERSON
@ SUMO_TAG_PERSONTRIP
@ SUMO_ATTR_COSTS
@ SUMO_ATTR_LINES
@ SUMO_ATTR_DEPART
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_BUS_STOP
@ SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_TOLONLAT
@ SUMO_ATTR_MODES
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_GROUP
@ SUMO_ATTR_COST
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_FROMXY
@ SUMO_ATTR_WALKFACTOR
@ SUMO_ATTR_TOXY
@ SUMO_ATTR_DURATION
@ SUMO_ATTR_FROMLONLAT
@ SUMO_ATTR_INTENDED
int gPrecision
the precision for floating point outputs
Definition: StdDefs.cpp:25
int gPrecisionGeo
Definition: StdDefs.cpp:26
T MIN2(T a, T b)
Definition: StdDefs.h:73
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandler.cpp:117
const std::string & getID() const
Returns the id.
Definition: Named.h:73
A storage for options typed value containers)
Definition: OptionsCont.h:89
bool exists(const std::string &name) const
Returns the information whether the named option is known.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:239
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setPrecision(int precision=gPrecision)
Sets the precison or resets it to default.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
A basic edge for routing applications.
Definition: ROEdge.h:70
bool isTazConnector() const
Definition: ROEdge.h:159
const ROEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition: ROEdge.cpp:361
double getLength() const
Returns the length of the edge.
Definition: ROEdge.h:210
const ROEdgeVector & getPredecessors() const
Returns the edge at the given position from the list of incoming edges.
Definition: ROEdge.h:361
The router's network representation.
Definition: RONet.h:62
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
Definition: RONet.cpp:334
static RONet * getInstance()
Returns the pointer to the unique instance of RONet (singleton).
Definition: RONet.cpp:55
const std::string getStoppingPlaceName(const std::string &id) const
return the name for the given stopping place id
Definition: RONet.cpp:784
A planItem can be a Trip which contains multiple tripItems.
Definition: ROPerson.h:270
double getDepartPos(bool replaceDefault=true) const
Definition: ROPerson.h:312
void saveVehicles(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const
Definition: ROPerson.cpp:208
SVCPermissions getModes() const
Definition: ROPerson.h:318
void updateMOdes(SVCPermissions additionalModes)
Definition: ROPerson.h:321
void saveAsXML(OutputDevice &os, const bool extended, const bool asTrip, const bool writeGeoTrip) const
Definition: ROPerson.cpp:217
const std::string & getStopDest() const
Definition: ROPerson.h:329
double getWalkFactor() const
Definition: ROPerson.h:338
SUMOTime getDuration() const
return duration sum of all trip items
Definition: ROPerson.cpp:292
double getArrivalPos(bool replaceDefault=true) const
Definition: ROPerson.h:315
const ROEdge * getDestination() const
Definition: ROPerson.h:302
virtual void addTripItem(TripItem *tripIt)
Definition: ROPerson.h:290
std::vector< ROVehicle * > & getVehicles()
Definition: ROPerson.h:296
PlanItem * clone() const
Definition: ROPerson.cpp:199
const std::string & getGroup() const
Definition: ROPerson.h:325
std::vector< TripItem * > myTripItems
the fully specified trips
Definition: ROPerson.h:352
void addVehicle(ROVehicle *veh)
Definition: ROPerson.h:293
const ROEdge * getOrigin() const
Definition: ROPerson.h:299
Every person has a plan comprising of multiple planItems.
Definition: ROPerson.h:79
A ride is part of a trip, e.g., go from here to here by car or bus.
Definition: ROPerson.h:179
const std::string lines
Definition: ROPerson.h:212
const std::string destStop
Definition: ROPerson.h:214
const std::string group
Definition: ROPerson.h:213
const double arr
Definition: ROPerson.h:217
const std::string intended
Definition: ROPerson.h:215
void saveAsXML(OutputDevice &os, const bool extended) const
Definition: ROPerson.cpp:137
const SUMOTime depart
Definition: ROPerson.h:216
const ROEdge *const to
Definition: ROPerson.h:211
const ROEdge *const from
Definition: ROPerson.h:210
A planItem can be a Stop.
Definition: ROPerson.h:108
A TripItem is part of a trip, e.g., go from here to here by car.
Definition: ROPerson.h:150
A walk is part of a trip, e.g., go from here to here by foot.
Definition: ROPerson.h:229
void saveAsXML(OutputDevice &os, const bool extended) const
Definition: ROPerson.cpp:173
void addRide(const ROEdge *const from, const ROEdge *const to, const std::string &lines, double arrivalPos, const std::string &destStop, const std::string &group)
Definition: ROPerson.cpp:112
virtual ~ROPerson()
Destructor.
Definition: ROPerson.cpp:52
ROPerson(const SUMOVehicleParameter &pars, const SUMOVTypeParameter *type)
Constructor.
Definition: ROPerson.cpp:47
void addTrip(const ROEdge *const from, const ROEdge *const to, const SVCPermissions modeSet, const std::string &vTypes, const double departPos, const double arrivalPos, const std::string &busStop, double walkFactor, const std::string &group)
Definition: ROPerson.cpp:60
void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)
Definition: ROPerson.cpp:358
void addWalk(const ConstROEdgeVector &edges, const double duration, const double speed, const double departPos, const double arrivalPos, const std::string &busStop)
Definition: ROPerson.cpp:122
void addStop(const SUMOVehicleParameter::Stop &stopPar, const ROEdge *const stopEdge)
Definition: ROPerson.cpp:131
bool computeIntermodal(SUMOTime time, const RORouterProvider &provider, PersonTrip *const trip, const ROVehicle *const veh, MsgHandler *const errorHandler)
Definition: ROPerson.cpp:301
void saveAsXML(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const
Saves the complete person description.
Definition: ROPerson.cpp:384
std::vector< PlanItem * > myPlan
The plan of the person.
Definition: ROPerson.h:404
A routable thing such as a vehicle or person.
Definition: RORoutable.h:52
const SUMOVehicleParameter & getParameter() const
Returns the definition of the vehicle / person parameter.
Definition: RORoutable.h:71
const std::string & getID() const
Returns the id of the routable.
Definition: RORoutable.h:91
SUMOVehicleClass getVClass() const
Definition: RORoutable.h:105
const SUMOVTypeParameter * getType() const
Returns the type of the routable.
Definition: RORoutable.h:82
bool myRoutingSuccess
Whether the last routing was successful.
Definition: RORoutable.h:179
Base class for a vehicle's route definition.
Definition: RORouteDef.h:53
void addLoadedAlternative(RORoute *alternative)
Adds a single alternative loaded from the file An alternative may also be generated during DUA.
Definition: RORouteDef.cpp:69
A complete router's route.
Definition: RORoute.h:52
void setProbability(double prob)
Sets the probability of the route.
Definition: RORoute.cpp:70
A vehicle as used by router.
Definition: ROVehicle.h:50
RORouteDef * getRouteDefinition() const
Returns the definition of the route the vehicle takes.
Definition: ROVehicle.h:73
IntermodalRouter< E, L, N, V > & getIntermodalRouter() const
Structure representing possible vehicle parameter.
void write(OutputDevice &dev) const
Writes the vtype.
bool saved
Information whether this type was already saved (needed by routers)
SUMOVehicleClass vehicleClass
The vehicle's class.
Definition of vehicle stop (position and duration)
Structure representing possible vehicle parameter.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
std::string vtypeid
The vehicle's type id.
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag tag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
double departPos
(optional) The position the vehicle shall depart from
std::string id
The vehicle's id.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
bool hasNext()
returns the information whether further substrings exist