diff --git a/src/microsim/devices/MSDevice_Taxi.cpp b/src/microsim/devices/MSDevice_Taxi.cpp index fdc25cdcc75a..2f7213f0729e 100644 --- a/src/microsim/devices/MSDevice_Taxi.cpp +++ b/src/microsim/devices/MSDevice_Taxi.cpp @@ -49,6 +49,7 @@ #include "MSDevice_Taxi.h" //#define DEBUG_DISPATCH +//#define DEBUG_CANCEL //#define DEBUG_COND (myHolder.isSelected()) #define DEBUG_COND (true) @@ -535,22 +536,20 @@ MSDevice_Taxi::cancelCurrentCustomers() { } // find customers of the current stop std::set customersToBeRemoved; + std::set onBoard; + onBoard.insert(myHolder.getPersons().begin(), myHolder.getPersons().end()); + onBoard.insert(myHolder.getContainers().begin(), myHolder.getContainers().end()); for (std::string tID : myHolder.getNextStopParameter()->permitted) { - //for (const MSTransportable* t : myCustomers) { for (auto t : myCustomers) { - //bool removed = false; - //if (t->getID() == tID) { - if (t->getID() == tID) { - //cancelCustomer(t); + if (t->getID() == tID && onBoard.count(t) == 0) { customersToBeRemoved.insert(t); - //removed = cancelCustomer((*tIt)); - } - //if (!removed) { - // tIt++; - //} } } + if (!customersToBeRemoved.empty()) { + WRITE_WARNINGF(TL("Taxi '%' aborts waiting for customers: % at time=%."), + myHolder.getID(), toString(customersToBeRemoved), time2string(SIMSTEP)); + } for (auto t : customersToBeRemoved) { cancelCustomer(t); } @@ -559,6 +558,12 @@ MSDevice_Taxi::cancelCurrentCustomers() { bool MSDevice_Taxi::cancelCustomer(const MSTransportable* t) { +#ifdef DEBUG_CANCEL + if (DEBUG_COND) { + std::cout << SIMTIME << " taxi=" << myHolder.getID() << " cancelCustomer " << t->getID() << "\n"; + } +#endif + // is the given transportable a customer of the reservations? if (myCustomers.count(t) == 0) { return false; diff --git a/tests/sumo/devices/taxi/prebooking/4persons_abort/dispatchinfos.sumo b/tests/sumo/devices/taxi/prebooking/4persons_abort/dispatchinfos.sumo new file mode 100644 index 000000000000..e686af66b2be --- /dev/null +++ b/tests/sumo/devices/taxi/prebooking/4persons_abort/dispatchinfos.sumo @@ -0,0 +1,47 @@ + + + + + + + diff --git a/tests/sumo/devices/taxi/prebooking/4persons_abort/errors.sumo b/tests/sumo/devices/taxi/prebooking/4persons_abort/errors.sumo new file mode 100644 index 000000000000..97a4440b4d50 --- /dev/null +++ b/tests/sumo/devices/taxi/prebooking/4persons_abort/errors.sumo @@ -0,0 +1,3 @@ +Warning: Taxi 'trip_0' aborts waiting for customers: p2 at time=247.00. +Warning: Person 'p2' aborted waiting for taxi at edge 'A1B1'. +Warning: Vehicle 'trip_0' aborted waiting for a person that will never come. diff --git a/tests/sumo/devices/taxi/prebooking/4persons_abort/input_routes.rou.xml b/tests/sumo/devices/taxi/prebooking/4persons_abort/input_routes.rou.xml new file mode 100644 index 000000000000..ecd919240145 --- /dev/null +++ b/tests/sumo/devices/taxi/prebooking/4persons_abort/input_routes.rou.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/devices/taxi/prebooking/4persons_abort/options.sumo b/tests/sumo/devices/taxi/prebooking/4persons_abort/options.sumo new file mode 100644 index 000000000000..2fee57ec7e1f --- /dev/null +++ b/tests/sumo/devices/taxi/prebooking/4persons_abort/options.sumo @@ -0,0 +1,6 @@ +--no-step-log --no-duration-log --net-file=net.net.xml +-r input_routes.rou.xml +--tripinfo-output tripinfos.xml +--tripinfo-output.write-unfinished +--device.taxi.dispatch-algorithm routeExtension +--device.taxi.dispatch-algorithm.output dispatchinfos.xml diff --git a/tests/sumo/devices/taxi/prebooking/4persons_abort/output.sumo b/tests/sumo/devices/taxi/prebooking/4persons_abort/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/devices/taxi/prebooking/4persons_abort/tripinfos.sumo b/tests/sumo/devices/taxi/prebooking/4persons_abort/tripinfos.sumo new file mode 100644 index 000000000000..20aea85b5193 --- /dev/null +++ b/tests/sumo/devices/taxi/prebooking/4persons_abort/tripinfos.sumo @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/devices/taxi/prebooking/4persons_abort/tripinfos.sumo.meso b/tests/sumo/devices/taxi/prebooking/4persons_abort/tripinfos.sumo.meso new file mode 100644 index 000000000000..9423730b2747 --- /dev/null +++ b/tests/sumo/devices/taxi/prebooking/4persons_abort/tripinfos.sumo.meso @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/dispatchinfos.sumo b/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/dispatchinfos.sumo new file mode 100644 index 000000000000..4f6a708c8f77 --- /dev/null +++ b/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/dispatchinfos.sumo @@ -0,0 +1,47 @@ + + + + + + + diff --git a/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/errors.sumo b/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/errors.sumo new file mode 100644 index 000000000000..393d2bb14818 --- /dev/null +++ b/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/errors.sumo @@ -0,0 +1,3 @@ +Warning: Taxi 'trip_0' aborts waiting for customers: p.3 p.4 at time=229.00. +Warning: Person 'p.3' aborted waiting for taxi at edge 'B2C2'. +Warning: Person 'p.4' aborted waiting for taxi at edge 'B2C2'. diff --git a/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/input_routes.rou.xml b/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/input_routes.rou.xml new file mode 100644 index 000000000000..0f46df3b9991 --- /dev/null +++ b/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/input_routes.rou.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/options.sumo b/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/options.sumo new file mode 100644 index 000000000000..2fee57ec7e1f --- /dev/null +++ b/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/options.sumo @@ -0,0 +1,6 @@ +--no-step-log --no-duration-log --net-file=net.net.xml +-r input_routes.rou.xml +--tripinfo-output tripinfos.xml +--tripinfo-output.write-unfinished +--device.taxi.dispatch-algorithm routeExtension +--device.taxi.dispatch-algorithm.output dispatchinfos.xml diff --git a/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/output.sumo b/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/tripinfos.sumo b/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/tripinfos.sumo new file mode 100644 index 000000000000..5c9149b03c17 --- /dev/null +++ b/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/tripinfos.sumo @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/tripinfos.sumo.meso b/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/tripinfos.sumo.meso new file mode 100644 index 000000000000..9423730b2747 --- /dev/null +++ b/tests/sumo/devices/taxi/prebooking/5persons_abort_sameTrip/tripinfos.sumo.meso @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/devices/taxi/prebooking/abort_pickup/errors.sumo b/tests/sumo/devices/taxi/prebooking/abort_pickup/errors.sumo index c044c39e08bf..e47c63a7957a 100644 --- a/tests/sumo/devices/taxi/prebooking/abort_pickup/errors.sumo +++ b/tests/sumo/devices/taxi/prebooking/abort_pickup/errors.sumo @@ -1,3 +1,4 @@ +Warning: Taxi 'trip_1' aborts waiting for customers: p0 at time=256.00. Warning: Person 'p0' aborted waiting for taxi at edge 'B2C2'. Warning: Vehicle 'trip_0' aborted waiting for a person that will never come. Warning: Vehicle 'trip_1' aborted waiting for a person that will never come. diff --git a/tests/sumo/devices/taxi/prebooking/greedy/too_late_next/errors.sumo b/tests/sumo/devices/taxi/prebooking/greedy/too_late_next/errors.sumo index f1e4fa5ac33a..98b6976e365b 100644 --- a/tests/sumo/devices/taxi/prebooking/greedy/too_late_next/errors.sumo +++ b/tests/sumo/devices/taxi/prebooking/greedy/too_late_next/errors.sumo @@ -1,2 +1,3 @@ +Warning: Taxi 'trip_0' aborts waiting for customers: p0 at time=254.00. Warning: Person 'p0' aborted waiting for taxi at edge 'C1C0'. Warning: Vehicle 'trip_0' aborted waiting for a person that will never come. diff --git a/tests/sumo/devices/taxi/prebooking/greedyShared/too_late_next/errors.sumo b/tests/sumo/devices/taxi/prebooking/greedyShared/too_late_next/errors.sumo index f1e4fa5ac33a..98b6976e365b 100644 --- a/tests/sumo/devices/taxi/prebooking/greedyShared/too_late_next/errors.sumo +++ b/tests/sumo/devices/taxi/prebooking/greedyShared/too_late_next/errors.sumo @@ -1,2 +1,3 @@ +Warning: Taxi 'trip_0' aborts waiting for customers: p0 at time=254.00. Warning: Person 'p0' aborted waiting for taxi at edge 'C1C0'. Warning: Vehicle 'trip_0' aborted waiting for a person that will never come. diff --git a/tests/sumo/devices/taxi/prebooking/testsuite.sumo b/tests/sumo/devices/taxi/prebooking/testsuite.sumo index 561e4edee7d7..a0d6205c5c18 100644 --- a/tests/sumo/devices/taxi/prebooking/testsuite.sumo +++ b/tests/sumo/devices/taxi/prebooking/testsuite.sumo @@ -15,5 +15,11 @@ abort_pickup # order taxi before the depart, using ride param "earliestPickupTime" default_reservationTime + +# 5 persons that do not want to share a taxi but use a sharing dispatcher +5persons_abort_sameTrip + +# 4 persons that do not want to share a taxi but use a sharing dispatcher +4persons_abort greedy greedyShared