Skip to content

Commit

Permalink
Merge branch 'main' of github.com:eclipse-sumo/sumo into Netedit_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Aug 29, 2024
2 parents b675ce2 + 58c3b3d commit bdff97b
Show file tree
Hide file tree
Showing 19 changed files with 440 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/microsim/devices/MSDevice_Taxi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "MSDevice_Taxi.h"

//#define DEBUG_DISPATCH
//#define DEBUG_CANCEL

//#define DEBUG_COND (myHolder.isSelected())
#define DEBUG_COND (true)
Expand Down Expand Up @@ -535,22 +536,20 @@ MSDevice_Taxi::cancelCurrentCustomers() {
}
// find customers of the current stop
std::set<const MSTransportable*> customersToBeRemoved;
std::set<const MSTransportable*> 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);
}
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on 2024-08-29 11:03:19 by Eclipse SUMO sumo Version v1_20_0+1774-ab2e9e1c5a0
This data file and the accompanying materials
are made available under the terms of the Eclipse Public License v2.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v20.html
This file may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the Eclipse
Public License 2.0 are satisfied: GNU General Public License, version 2
or later which is available at
https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
<sumoConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/sumoConfiguration.xsd">
<input>
<net-file value="net.net.xml"/>
<route-files value="input_routes.rou.xml"/>
</input>
<output>
<write-license value="true"/>
<tripinfo-output value="tripinfos.xml"/>
<tripinfo-output.write-unfinished value="true"/>
</output>
<processing>
<default.speeddev value="0"/>
</processing>
<report>
<xml-validation value="never"/>
<duration-log.disable value="true"/>
<no-step-log value="true"/>
</report>
<taxi_device>
<device.taxi.dispatch-algorithm value="routeExtension"/>
<device.taxi.dispatch-algorithm.output value="dispatchinfos.xml"/>
</taxi_device>
</sumoConfiguration>
-->

<DispatchInfo>
<dispatchShared time="0.00" id="trip_0" persons="p0" sharingPersons="p0 p2 p1 p1 p0 p2" type="routeExtension"/>
</DispatchInfo>
3 changes: 3 additions & 0 deletions tests/sumo/devices/taxi/prebooking/4persons_abort/errors.sumo
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd">
<vType id="taxi_large" personCapacity="8" vClass="taxi" length="8">
<param key="has.taxi.device" value="true"/>
</vType>

<trip id="trip_0" type="taxi_large" depart="0.00" from="A0B0" to="B0C0"/>

<person id="p0" depart="0.00">
<ride from="A1B1" to="E1F1" lines="taxi">
<param key="earliestPickupTime" value="0.00"/>
<param key="reservationTime" value="0.00"/>
</ride>
</person>
<person id="p1" depart="0.00">
<ride from="B1C1" to="D1E1" lines="taxi">
<param key="earliestPickupTime" value="0.00"/>
<param key="reservationTime" value="0.00"/>
</ride>
</person>

<person id="p2" depart="300.00">
<ride from="A1B1" to="E1F1" lines="taxi">
<param key="earliestPickupTime" value="0.00"/>
<param key="reservationTime" value="0.00"/>
</ride>
</person>
<person id="p3" depart="300.00">
<ride from="B1C1" to="D1E1" lines="taxi">
<param key="earliestPickupTime" value="0.00"/>
<param key="reservationTime" value="0.00"/>
</ride>
</person>

</routes>
Original file line number Diff line number Diff line change
@@ -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
Empty file.
61 changes: 61 additions & 0 deletions tests/sumo/devices/taxi/prebooking/4persons_abort/tripinfos.sumo
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on 2024-08-29 11:27:47 by Eclipse SUMO sumo Version v1_20_0+1780-64450e32b54
This data file and the accompanying materials
are made available under the terms of the Eclipse Public License v2.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v20.html
This file may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the Eclipse
Public License 2.0 are satisfied: GNU General Public License, version 2
or later which is available at
https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
<sumoConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/sumoConfiguration.xsd">
<input>
<net-file value="net.net.xml"/>
<route-files value="input_routes.rou.xml"/>
</input>
<output>
<write-license value="true"/>
<tripinfo-output value="tripinfos.xml"/>
<tripinfo-output.write-unfinished value="true"/>
</output>
<processing>
<default.speeddev value="0"/>
</processing>
<report>
<xml-validation value="never"/>
<duration-log.disable value="true"/>
<no-step-log value="true"/>
</report>
<taxi_device>
<device.taxi.dispatch-algorithm value="routeExtension"/>
<device.taxi.dispatch-algorithm.output value="dispatchinfos.xml"/>
</taxi_device>
</sumoConfiguration>
-->

<tripinfos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/tripinfo_file.xsd">
<personinfo id="p1" depart="0.00" type="DEFAULT_PEDTYPE" speedFactor="1.00" duration="416.00" waitingTime="279.00" timeLoss="14.82" traveltime="137.00">
<ride waitingTime="279.00" vehicle="trip_0" depart="279.00" arrival="416.00" arrivalPos="285.60" duration="137.00" routeLength="877.63" timeLoss="14.82"/>
</personinfo>
<personinfo id="p0" depart="0.00" type="DEFAULT_PEDTYPE" speedFactor="1.00" duration="509.00" waitingTime="247.00" timeLoss="33.62" traveltime="262.00">
<ride waitingTime="247.00" vehicle="trip_0" depart="247.00" arrival="509.00" arrivalPos="285.60" duration="262.00" routeLength="1477.63" timeLoss="33.62"/>
</personinfo>
<personinfo id="p3" depart="300.00" type="DEFAULT_PEDTYPE" speedFactor="1.00" duration="486.00" waitingTime="349.00" timeLoss="14.82" traveltime="137.00">
<ride waitingTime="349.00" vehicle="trip_0" depart="649.00" arrival="786.00" arrivalPos="285.60" duration="137.00" routeLength="877.67" timeLoss="14.82"/>
</personinfo>
<personinfo id="p2" depart="300.00" type="DEFAULT_PEDTYPE" speedFactor="1.00" duration="-1" waitingTime="489.00" timeLoss="-1" traveltime="-1">
<ride waitingTime="489.00" vehicle="NULL" depart="-1" arrival="-1" arrivalPos="-1" duration="-1" routeLength="-1" timeLoss="-1"/>
</personinfo>
<tripinfo id="trip_0" depart="0.00" departLane="A0B0_1" departPos="8.10" departSpeed="0.00" departDelay="0.00" arrival="-1.00" arrivalLane="" arrivalPos="-1.00" arrivalSpeed="-1.00" duration="789.00" routeLength="4240.36" waitingTime="13.00" waitingCount="4" stopTime="400.00" timeLoss="80.05" rerouteNo="6" devices="tripinfo_trip_0 routing_trip_0 taxi_trip_0 person_trip_0" vType="taxi_large" speedFactor="1.00" vaporized="">
<taxi customers="3" occupiedDistance="2355.29" occupiedTime="224.00"/>
</tripinfo>
</tripinfos>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on 2024-08-26 15:32:41 by Eclipse SUMO sumo Version v1_20_0+1721-016cfd09667
This data file and the accompanying materials
are made available under the terms of the Eclipse Public License v2.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v20.html
This file may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the Eclipse
Public License 2.0 are satisfied: GNU General Public License, version 2
or later which is available at
https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
<sumoConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/sumoConfiguration.xsd">
<input>
<net-file value="net.net.xml"/>
<route-files value="input_routes.rou.xml"/>
</input>
<output>
<write-license value="true"/>
<tripinfo-output value="tripinfos.xml"/>
<tripinfo-output.write-unfinished value="true"/>
</output>
<processing>
<default.speeddev value="0"/>
</processing>
<report>
<xml-validation value="never"/>
<duration-log.disable value="true"/>
<no-step-log value="true"/>
</report>
<mesoscopic>
<mesosim value="true"/>
</mesoscopic>
</sumoConfiguration>
-->

<tripinfos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/tripinfo_file.xsd">
<personinfo id="p.0" depart="0.00" type="DEFAULT_PEDTYPE" speedFactor="1.00" duration="122.00" waitingTime="34.00" timeLoss="0.00" traveltime="88.00">
<ride waitingTime="34.00" vehicle="trip_0" depart="34.00" arrival="122.00" arrivalPos="191.73" duration="88.00" routeLength="1221.73" timeLoss="0.00"/>
</personinfo>
<personinfo id="p.1" depart="0.00" type="DEFAULT_PEDTYPE" speedFactor="1.00" duration="291.00" waitingTime="202.00" timeLoss="0.00" traveltime="89.00">
<ride waitingTime="202.00" vehicle="trip_0" depart="202.00" arrival="291.00" arrivalPos="191.73" duration="89.00" routeLength="1221.73" timeLoss="0.00"/>
</personinfo>
<personinfo id="p.2" depart="0.00" type="DEFAULT_PEDTYPE" speedFactor="1.00" duration="459.00" waitingTime="370.00" timeLoss="0.00" traveltime="89.00">
<ride waitingTime="370.00" vehicle="trip_0" depart="370.00" arrival="459.00" arrivalPos="191.73" duration="89.00" routeLength="1221.73" timeLoss="0.00"/>
</personinfo>
<personinfo id="p.3" depart="0.00" type="DEFAULT_PEDTYPE" speedFactor="1.00" duration="627.00" waitingTime="538.00" timeLoss="0.00" traveltime="89.00">
<ride waitingTime="538.00" vehicle="trip_0" depart="538.00" arrival="627.00" arrivalPos="191.73" duration="89.00" routeLength="1221.73" timeLoss="0.00"/>
</personinfo>
<personinfo id="p.4" depart="0.00" type="DEFAULT_PEDTYPE" speedFactor="1.00" duration="795.00" waitingTime="706.00" timeLoss="0.00" traveltime="89.00">
<ride waitingTime="706.00" vehicle="trip_0" depart="706.00" arrival="795.00" arrivalPos="191.73" duration="89.00" routeLength="1221.73" timeLoss="0.00"/>
</personinfo>
<tripinfo id="trip_0" depart="0.00" departLane="A0B0_1" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="-1.00" arrivalLane="" arrivalPos="-1.00" arrivalSpeed="-1.00" duration="856.00" routeLength="7635.73" waitingTime="0.00" waitingCount="0" stopTime="305.00" timeLoss="240.00" rerouteNo="11" devices="tripinfo_trip_0 routing_trip_0 taxi_trip_0 person_trip_0" vType="taxi_small" speedFactor="1.00" vaporized="">
<taxi customers="5" occupiedDistance="6108.67" occupiedTime="444.80"/>
</tripinfo>
</tripinfos>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on 2024-08-28 13:54:06 by Eclipse SUMO sumo Version v1_20_0+1753-8d7e5fec371
This data file and the accompanying materials
are made available under the terms of the Eclipse Public License v2.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v20.html
This file may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the Eclipse
Public License 2.0 are satisfied: GNU General Public License, version 2
or later which is available at
https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
<sumoConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/sumoConfiguration.xsd">
<input>
<net-file value="net.net.xml"/>
<route-files value="input_routes.rou.xml"/>
</input>
<output>
<write-license value="true"/>
<tripinfo-output value="tripinfos.xml"/>
<tripinfo-output.write-unfinished value="true"/>
</output>
<processing>
<default.speeddev value="0"/>
</processing>
<report>
<xml-validation value="never"/>
<duration-log.disable value="true"/>
<no-step-log value="true"/>
</report>
<taxi_device>
<device.taxi.dispatch-algorithm value="routeExtension"/>
<device.taxi.dispatch-algorithm.output value="dispatchinfos.xml"/>
</taxi_device>
</sumoConfiguration>
-->

<DispatchInfo>
<dispatchShared time="0.00" id="trip_0" persons="p.0" sharingPersons="p.0 p.1 p.2 p.3 p.4 p.0 p.4 p.3 p.2 p.1" type="routeExtension"/>
</DispatchInfo>
Original file line number Diff line number Diff line change
@@ -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'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd">
<vType id="taxi_large" personCapacity="8" vClass="taxi" length="8">
<param key="has.taxi.device" value="true"/>
</vType>

<trip id="trip_0" type="taxi_large" depart="0.00" from="A0B0" to="B0C0">
<stop lane="A0B0_1" triggered="person"/>
</trip>

<personFlow id="p" number="5" begin="0.00" end="400">
<ride from="B2C2" to="A0B0" lines="taxi">
<param key="earliestPickupTime" value="0.00"/>
<param key="reservationTime" value="0.00"/>
</ride>
</personFlow>

</routes>
Original file line number Diff line number Diff line change
@@ -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
Empty file.
Loading

0 comments on commit bdff97b

Please sign in to comment.