31 #define DEBUG_COND2(obj) (true)
55 double directTime = -1;
56 double directTime2 = -1;
57 for (
auto it2 = resIt + 1; it2 != reservations.end(); it2++) {
59 if (capacityLeft < (
int)res2->
persons.size()) {
67 const double absLossPickup = detourTime - directTime;
68 const double relLossPickup = absLossPickup / directTime;
72 <<
" absLossPickup=" << absLossPickup
73 <<
" relLossPickup=" << relLossPickup
78 double directTimeTmp = -1;
82 const double absLoss_c1 = absLossPickup + (detourTime2 - directTimeTmp);
83 const double relLoss_c1 = absLoss_c1 / directTime;
88 const double absLoss_c2 = detourTime3 - directTime2;
89 const double relLoss_c2 = absLoss_c2 / directTime2;
94 absLoss = absLossPickup;
95 relLoss = relLossPickup;
96 absLoss2 = absLoss_c2;
97 relLoss2 = relLoss_c2;
101 absLoss = absLoss_c1;
102 relLoss = relLoss_c1;
106 if (shareCase != 0) {
107 reservations.erase(it2);
110 #ifdef DEBUG_DISPATCH
112 <<
" absLoss_c1=" << absLoss_c1
113 <<
" relLoss_c1=" << relLoss_c1
114 <<
" absLoss_c2=" << absLoss_c2
115 <<
" relLoss_c2=" << relLoss_c2
121 if (shareCase != 0) {
136 #ifdef DEBUG_DISPATCH
138 <<
" type=" << shareCase
139 <<
" absLoss=" << absLoss <<
" relLoss=" << relLoss
140 <<
" absLoss2=" << absLoss2 <<
" relLoss2=" << relLoss2
148 resIt = reservations.erase(resIt);
149 return shareCase == 0 ? 1 : 2;
std::string time2string(SUMOTime t)
convert SUMOTime to string
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A device which collects info on the vehicle trip (mainly on departure and arrival)
void dispatch(const Reservation &res)
service the given reservation
void dispatchShared(const std::vector< const Reservation * > &reservations)
service the given reservations
const double myRelativeLossThreshold
relative time threshold for declining shared ride
const double myAbsoluteLossThreshold
absolute time threshold for declining shared ride in s
virtual int dispatch(MSDevice_Taxi *taxi, std::vector< Reservation * >::iterator &resIt, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, std::vector< Reservation * > &reservations)
trigger taxi dispatch.
OutputDevice * myOutput
optional file output for dispatch information
static double computeDetourTime(SUMOTime t, SUMOTime viaTime, const MSDevice_Taxi *taxi, const MSEdge *from, double fromPos, const MSEdge *via, double viaPos, const MSEdge *to, double toPos, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, double &timeDirect)
compute directTime and detourTime
void servedReservation(const Reservation *res)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
SUMOVehicle & getHolder() const
Returns the vehicle that holds this device.
int getPersonCapacity() const
Get this vehicle type's person capacity.
const std::string & getID() const
Returns the id.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >())
Writes an XML header with optional configuration.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
std::set< MSTransportable * > persons