55 const std::string& vTypes,
const double speed,
const double walkFactor,
56 const std::string& group,
57 const double departPosLat,
const bool hasArrivalPos,
const double arrivalPos):
110std::vector<SUMOVehicle*>
112 std::vector<SUMOVehicleParameter*> pars;
115 pars.back()->vtypeid = st.next();
118 pars.back()->id = transportable->
getID() +
"_" +
toString(pars.size() - 1);
123 pars.back()->id = transportable->
getID() +
"_0";
129 pars.back()->vtypeid = item.second;
130 pars.back()->id = transportable->
getID() +
"_taxi_" + item.second;
131 pars.back()->line =
"taxi";
137 pars.back()->id = transportable->
getID() +
"_b0";
142 std::vector<SUMOVehicle*> result;
154 vehPar->arrivalSpeed = 0;
157 WRITE_WARNINGF(
TL(
"Ignoring vehicle type '%' when routing person '%' because it is not allowed on the start edge."), type->
getID(), transportable->
getID());
163 if (result.empty()) {
165 result.push_back(
nullptr);
173 MSStage* previous,
const MSEdge* origin,
const MSEdge* destination, std::vector<MSStage*>& stages) {
179 double minCost = std::numeric_limits<double>::max();
180 std::vector<MSTransportableRouter::TripItem> minResult;
183 std::vector<MSTransportableRouter::TripItem> result;
189 if (router.
compute(origin, destination, departPos, prevStop ==
nullptr ?
"" : prevStop->
getID(),
192 double totalCost = 0;
193 for (
const MSTransportableRouter::TripItem& item : result) {
194 totalCost += item.cost;
196 if (totalCost < minCost) {
198 minResult.swap(result);
199 std::swap(minVehicle, vehicle);
202 if (vehicle !=
nullptr) {
207 if (minCost != std::numeric_limits<double>::max()) {
209 bool carUsed =
false;
210 for (std::vector<MSTransportableRouter::TripItem>::iterator it = minResult.begin(); it != minResult.end(); ++it) {
211 if (!it->edges.empty()) {
213 double localArrivalPos = bs !=
nullptr ? bs->
getAccessPos(it->edges.back()) : it->arrivalPos;
214 const MSEdge*
const first = it->edges.front();
219 if (it->line ==
"") {
241 const MSEdge* last = it->edges.back();
252 stages.push_back(previous);
253 }
else if (isTaxi && it->line == minVehicle->
getID()) {
258 const MSEdge* last = prevEdges.back();
259 const MSEdge* prev = prevEdges[prevEdges.size() - 2];
266 previous =
new MSStageDriving(rideOrigin, it->edges.back(), bs, localArrivalPos, 0.0, std::vector<std::string>({
"taxi" }),
myGroup);
270 stages.push_back(previous);
271 }
else if (minVehicle !=
nullptr && it->line == minVehicle->
getID()) {
272 previous =
new MSStageDriving(rideOrigin, it->edges.back(), bs, localArrivalPos, 0.0, std::vector<std::string>({ it->line }));
276 stages.push_back(previous);
284 previous =
new MSStageDriving(rideOrigin, it->edges.back(), bs, localArrivalPos, 0.0, std::vector<std::string>({ line }),
myGroup, it->intended,
TIME2STEPS(it->depart));
288 stages.push_back(previous);
297 if (minVehicle !=
nullptr && (isTaxi || !carUsed)) {
305 stages.push_back(previous);
310 if (stages.empty()) {
328 std::vector<MSStage*> stages;
344 for (
MSStage* stage : stages) {
354 transportable->
proceed(net, now);
362 :
"edge '" +
myOrigin->getID()) +
"'";
396 std::vector<std::string> modes;
398 modes.push_back(
"car");
401 modes.push_back(
"bicycle");
404 modes.push_back(
"taxi");
407 modes.push_back(
"public");
409 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
@ 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...
static const std::map< SUMOVehicleClass, std::string > & getTaxiTypes()
return all types that are known to carry a taxi device (or the default type if no devices are initial...
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)
void routeOutput(const bool isPerson, OutputDevice &os, const bool withRouteLength, const MSStage *const previous, const bool withTiming, const bool saveState=false) const
Called on writing vehroute output.
const MSEdge * getEdge() const
Returns the current edge.
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 & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false)
writes a named attribute
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.
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