35 #define DEBUG_COND2(obj) (true)
66 const MSEdge* from,
double fromPos,
67 const MSEdge* to,
double toPos,
68 const std::string& group,
77 if (res->
persons.count(person) == 0
81 && res->
toPos == toPos
82 && (
int)res->
persons.size() < maxCapacity) {
91 Reservation* newRes =
new Reservation({person}, reservationTime, pickupTime, from, fromPos, to, toPos, group);
96 #ifdef DEBUG_RESERVATION
98 <<
" addReservation p=" << person->
getID()
101 <<
" from=" << from->
getID() <<
" fromPos=" << fromPos
102 <<
" to=" << to->
getID() <<
" toPos=" << toPos
103 <<
" group=" << group
104 <<
" added=" << added
110 std::vector<Reservation*>
112 std::vector<Reservation*> reservations;
114 reservations.insert(reservations.end(), it.second.begin(), it.second.end());
126 auto it2 = std::find(it->second.begin(), it->second.end(), res);
127 if (it2 == it->second.end()) {
128 throw ProcessError(
"Inconsistent group reservations (2).");
131 it->second.erase(it2);
132 if (it->second.empty()) {
149 const MSEdge* from,
double fromPos,
150 const MSEdge* via,
double viaPos,
151 const MSEdge* to,
double toPos,
153 double& timeDirect) {
155 if (timeDirect < 0) {
165 std::cout <<
" leg1=" <<
toString(edges) <<
" startPos=" << fromPos <<
" toPos=" << viaPos <<
" time=" << leg1 <<
"\n";
167 const double wait =
MAX2(0.0,
STEPS2TIME(viaTime) - (start + leg1));
170 router.
compute(via, viaPos, to, toPos, &taxi->
getHolder(), timeContinue, edges);
172 const double timeDetour = leg1 + wait + leg2;
174 std::cout <<
" leg2=" <<
toString(edges) <<
" startPos=" << viaPos <<
" toPos=" << toPos <<
" time=" << leg2 <<
"\n";
176 <<
" from=" << from->
getID() <<
" to=" << to->
getID() <<
" via=" << via->
getID()
177 <<
" direct=" << timeDirect <<
" detour=" << timeDetour <<
" wait=" << wait <<
"\n";
std::vector< const MSEdge * > ConstMSEdgeVector
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)
OutputDevice * myOutput
optional file output for dispatch information
static SUMOTime computePickupTime(SUMOTime t, const MSDevice_Taxi *taxi, const Reservation &res, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router)
compute time to pick up the given reservation
bool myHasServableReservations
whether the last call to computeDispatch has left servable reservations
std::map< std::string, std::vector< Reservation * > > myGroupReservations
std::vector< Reservation * > getReservations()
retrieve all reservations
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
virtual Reservation * addReservation(MSTransportable *person, SUMOTime reservationTime, SUMOTime pickupTime, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, const std::string &group, int maxCapacity)
add a new reservation
MSDispatch(const std::map< std::string, std::string > ¶ms)
Constructor;.
void servedReservation(const Reservation *res)
A road/street connecting two junctions.
SUMOVehicle & getHolder() const
Returns the vehicle that holds this device.
const std::string & getID() const
Returns the id.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static OptionsCont & getOptions()
Retrieves the options.
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.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
An upper class for objects with additional parameters.
double recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime, double *lengthp=nullptr) const
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into, bool silent=false)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
virtual const MSEdge * getEdge() const =0
Returns the edge the object is currently at.
virtual double getPositionOnLane() const =0
Get the object's position along the lane.
std::string getID() const
debug identification
std::set< MSTransportable * > persons