54 const std::string& vTypes,
const double speed,
const double walkFactor,
55 const std::string& group,
56 const double departPosLat,
const bool hasArrivalPos,
const double arrivalPos):
109std::vector<SUMOVehicle*>
111 std::vector<SUMOVehicleParameter*> pars;
114 pars.back()->vtypeid = st.next();
117 pars.back()->id = transportable->
getID() +
"_" +
toString(pars.size() - 1);
122 pars.back()->id = transportable->
getID() +
"_0";
128 pars.back()->id = transportable->
getID() +
"_taxi";
129 pars.back()->line =
"taxi";
134 pars.back()->id = transportable->
getID() +
"_b0";
139 std::vector<SUMOVehicle*> result;
151 vehPar->arrivalSpeed = 0;
154 WRITE_WARNINGF(
TL(
"Ignoring vehicle type '%' when routing person '%' because it is not allowed on the start edge."), type->
getID(), transportable->
getID());
160 if (result.empty()) {
162 result.push_back(
nullptr);
170 MSStage* previous,
const MSEdge* origin,
const MSEdge* destination, std::vector<MSStage*>& stages) {
176 double minCost = std::numeric_limits<double>::max();
177 std::vector<MSTransportableRouter::TripItem> minResult;
180 std::vector<MSTransportableRouter::TripItem> result;
186 if (router.
compute(origin, destination, departPos, prevStop ==
nullptr ?
"" : prevStop->
getID(),
189 double totalCost = 0;
190 for (
const MSTransportableRouter::TripItem& item : result) {
191 totalCost += item.cost;
193 if (totalCost < minCost) {
195 minResult.swap(result);
196 std::swap(minVehicle, vehicle);
199 if (vehicle !=
nullptr) {
204 if (minCost != std::numeric_limits<double>::max()) {
206 bool carUsed =
false;
207 for (std::vector<MSTransportableRouter::TripItem>::iterator it = minResult.begin(); it != minResult.end(); ++it) {
208 if (!it->edges.empty()) {
210 double localArrivalPos = bs !=
nullptr ? bs->
getAccessPos(it->edges.back()) : it->arrivalPos;
211 const MSEdge*
const first = it->edges.front();
216 if (it->line ==
"") {
238 const MSEdge* last = it->edges.back();
249 stages.push_back(previous);
250 }
else if (isTaxi && it->line == minVehicle->
getID()) {
255 const MSEdge* last = prevEdges.back();
256 const MSEdge* prev = prevEdges[prevEdges.size() - 2];
263 previous =
new MSStageDriving(rideOrigin, it->edges.back(), bs, localArrivalPos, 0.0, std::vector<std::string>({
"taxi" }),
myGroup);
267 stages.push_back(previous);
268 }
else if (minVehicle !=
nullptr && it->line == minVehicle->
getID()) {
269 previous =
new MSStageDriving(rideOrigin, it->edges.back(), bs, localArrivalPos, 0.0, std::vector<std::string>({ it->line }));
273 stages.push_back(previous);
281 previous =
new MSStageDriving(rideOrigin, it->edges.back(), bs, localArrivalPos, 0.0, std::vector<std::string>({ line }),
myGroup, it->intended,
TIME2STEPS(it->depart));
285 stages.push_back(previous);
294 if (minVehicle !=
nullptr && (isTaxi || !carUsed)) {
302 stages.push_back(previous);
307 if (stages.empty()) {
325 std::vector<MSStage*> stages;
341 for (
MSStage* stage : stages) {
351 transportable->
proceed(net, now);
359 :
"edge '" +
myOrigin->getID()) +
"'";
393 std::vector<std::string> modes;
395 modes.push_back(
"car");
398 modes.push_back(
"bicycle");
401 modes.push_back(
"taxi");
404 modes.push_back(
"public");
406 if (modes.size() > 0) {
std::vector< const MSEdge * > ConstMSEdgeVector
IntermodalRouter< MSEdge, MSLane, MSJunction, SUMOVehicle > MSTransportableRouter
#define WRITE_WARNINGF(...)
std::shared_ptr< const MSRoute > ConstMSRoutePtr
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::string DEFAULT_TAXITYPE_ID
@ SVC_IGNORING
vehicles ignoring classes
@ 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_BIKETYPE_ID
const long long int VEHPARS_ARRIVALSPEED_SET
@ GIVEN
The speed is given.
@ RANDOM
A random position is chosen.
@ GIVEN
The position is given.
const std::string LINE_ANY
std::vector< SUMOVehicleParameter::Stop > StopParVector
const long long int VEHPARS_DEPARTPOS_SET
const long long int VEHPARS_ARRIVALPOS_SET
const long long int VEHPARS_VTYPE_SET
@ GIVEN
The arrival position is given.
@ TRIGGERED
The departure is person triggered.
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool compute(const E *from, const E *to, const double departPos, const std::string &originStopID, const double arrivalPos, const std::string &stopID, const double speed, const V *const vehicle, const SUMOVTypeParameter &pars, const SVCPermissions modeSet, const SUMOTime msTime, std::vector< TripItem > &into, const double externalFactor=0.)
Builds the route between the given edges using the minimum effort at the given time The definition of...
A road/street connecting two junctions.
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
const MSJunction * getToJunction() const
double getLength() const
return the length of the edge
const MSJunction * getFromJunction() const
bool isTazConnector() const
const MSEdgeVector & getPredecessors() const
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
static bool gLefthand
Whether lefthand-drive is being simulated.
The simulated network and simulation perfomer.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSTransportableRouter & getIntermodalRouter(int rngIndex, const int routingMode=0, const Prohibitions &prohibited={}) const
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
const MSEdge * getDestination() const
returns the destination edge
virtual ConstMSEdgeVector getEdges() const
the edges of the current stage
virtual double getArrivalPos() const
void setTrip(MSStageTrip *trip)
MSStoppingPlace * myDestinationStop
the stop to reach by getting transported (if any)
const std::string myGroup
The id of the group of transportables traveling together.
virtual const std::string setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now, const bool vehicleArrived)
logs end of the step
double getCosts() const
Returns the costs of the stage.
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
bool wasSet(int what) const
MSStageType getStageType() const
void setArrivalPos(double arrivalPos)
void setCosts(double costs)
Sets the costs of the stage.
MSStage(const MSStageType type, const MSEdge *destination, MSStoppingPlace *toStop, const double arrivalPos, const double arrivalPosLat=0.0, const std::string &group="")
constructor
SUMOTime myArrived
the time at which this stage ended
double getEdgeAngle(const MSEdge *e, double at) const
get angle of the edge at a certain position
static const double ROADSIDE_OFFSET
the offset for computing positions when standing at an edge
double myArrivalPos
the longitudinal position at which we want to arrive
Position getEdgePosition(const MSEdge *e, double at, double offset) const
get position on edge e at length at with orthogonal offset
const MSEdge * myDestination
the next edge to reach by getting transported
const bool myHaveArrivalPos
whether an arrivalPos was in the input
double getAngle(SUMOTime now) const
returns the angle of the transportable
MSStageTrip(const MSEdge *origin, MSStoppingPlace *fromStop, const MSEdge *destination, MSStoppingPlace *toStop, const SUMOTime duration, const SVCPermissions modeSet, const std::string &vTypes, const double speed, const double walkFactor, const std::string &group, const double departPosLat, const bool hasArrivalPos, const double arrivalPos)
constructor
void proceed(MSNet *net, MSTransportable *transportable, SUMOTime now, MSStage *previous)
proceeds to the next step
const std::string setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now, const bool vehicleArrived)
logs end of the step
std::string getOriginDescription() const
std::string getStageSummary(const bool isPerson) const
return string summary of the current stage
const std::string myVTypes
The possible vehicles to use.
double myDepartPos
The depart position.
double getEdgePos(SUMOTime now) const
const std::string reroute(const SUMOTime time, MSTransportableRouter &router, MSTransportable *const transportable, MSStage *previous, const MSEdge *origin, const MSEdge *destination, std::vector< MSStage * > &stages)
const MSEdge * getEdge() const
Returns the current edge.
void routeOutput(const bool isPerson, OutputDevice &os, const bool withRouteLength, const MSStage *const previous) const
Called on writing vehroute output.
const MSEdge * myOrigin
the origin edge
const double mySpeed
The walking speed.
MSStoppingPlace * myOriginStop
the origin edge
std::vector< SUMOVehicle * > getVehicles(MSVehicleControl &vehControl, MSTransportable *transportable, const MSEdge *origin)
std::string getDestinationDescription() const
SUMOTime myDuration
the time the trip should take (applies to only walking)
const double myWalkFactor
The factor to apply to walking durations.
const double myDepartPosLat
The lateral depart position.
const SVCPermissions myModeSet
The allowed modes of transportation.
Position getPosition(SUMOTime now) const
returns the position of the transportable
virtual ~MSStageTrip()
destructor
A lane area vehicles can halt at.
double getBeginLanePosition() const
Returns the begin position of this stop.
double getEndLanePosition() const
Returns the end position of this stop.
double getAccessPos(const MSEdge *edge, SumoRNG *rng=nullptr) const
the position on the given edge which is connected to this stop, -1 on failure
MSStage * getNextStage(int offset) const
Return the next (or previous) stage denoted by the offset.
virtual bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false)
double getMaxSpeed() const override
Returns the maximum speed (the minimum of desired and physical maximum speed).
const SUMOVTypeParameter & getVTypeParameter() const override
Returns the object's "vehicle" type parameter.
int getCurrentStageIndex() const
Return the index of the current stage.
const SUMOVehicleParameter & getParameter() const override
Returns the vehicle's parameter (including departure definition).
void appendStage(MSStage *stage, int next=-1)
Appends the given stage to the current plan.
The class responsible for building and deletion of vehicles.
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
void discountRoutingVehicle()
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, SumoRNG *rng=nullptr, bool readOnly=false)
Returns the named vehicle type or a sample from the named distribution.
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, ConstMSRoutePtr route, MSVehicleType *type, const bool ignoreStopErrors, const VehicleDefinitionSource source=ROUTEFILE, bool addRouteStops=true)
Builds a vehicle, increases the number of built vehicles.
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false, bool wasKept=false)
Deletes the vehicle.
The car-following model and parameter.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
const std::string & getID() const
Returns the name of the vehicle type.
const std::string & getID() const
Returns the id.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float).
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String).
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool).
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setParameters(const Parameterised ¶ms)
set the given key/value map in map<string, string> format
A point in 2D or 3D with translation and scaling methods.
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1).
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition).
Representation of a vehicle.
virtual bool replaceRouteEdges(ConstMSEdgeVector &edges, double cost, double savings, const std::string &info, bool onInit=false, bool check=false, bool removeStops=true, std::string *msgReturn=nullptr)=0
Replaces the current route by the given edges.
virtual void setArrivalPos(double arrivalPos)=0
Sets this vehicle's desired arrivalPos for its current route.
Structure representing possible vehicle parameter.
std::string vtypeid
The vehicle's type id.
double departPos
(optional) The position the vehicle shall depart from
double arrivalPos
(optional) The position the vehicle shall arrive on
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
std::string line
The vehicle's line (mainly for public transport).
bool hasNext()
returns the information whether further substrings exist