lcodeca / SUMOActivityGen

An Activity-based Multi-modal Mobility Scenario Generator for SUMO. This project is available in the Eclipse SUMO contributed tools section (https://github.com/eclipse/sumo/tree/master/tools/contributed) under the name SAGA (SUMO Activity GenerAtion).
Eclipse Public License 2.0
39 stars 25 forks source link

PT routes are not found and raises sagaexceptions.TripGenerationGenericError #45

Closed colton-nevs closed 1 year ago

colton-nevs commented 1 year ago

For public transit routes, I get the following error CRITICAL: _generate_intermodal_trip_traci from "['0']" to "['4']" with "public" generated 10 errors, trip generation aborted..

During the callstack

activitygen._compute_trips_per_slice()
_final_chain, _stages, _selected_mode = activitygen._generate_trip(
    self._conf['taz'][m_slice['loc_origin']],
    self._conf['taz'][m_slice['loc_primary']],
    _chain, _modes)
_person_steps, _person_stages = activitygen._generate_intermodal_trip_traci(
    from_area, to_area, activity_chain, mode)
_person_stages = activities._chains.generate_person_stages(
    from_area, to_area, activity_chain, mode)
from_edge, to_edge = activities._stages_define_main_locations(
    from_area, to_area, mode)

And the resulting route (line #109)

route = self._sumo.simulation.findIntermodalRoute(
    from_edge, to_edge, modes=_mode, pType=_ptype, vType=_vtype)

does not pass sumoutils.is_valid_route() because stage.line=='' forall stages in the route, i.e. because it is a walking route. I believe this is because no depart time is provided, and the current simulation time is 0.0. This is midnight, when basically no PT routes are running, so its not surprising the cheapest route returned by this call to traci.simulation.findIntermodalRoute() returns a walking route and the trip generation fails.

I'm curious why in activitygen._generate_intermodal_trip_traci(), the depart time is selected after finding the _person_stages?

lcodeca commented 1 year ago

Unless traci.simulation.findIntermodalRoute() has changed, the time does not matter. The departure time is selected after the trip has been generated because you know when you need to be at your destination, and you will decide when to leave to be there on time. I need to know the expected travel time before I know when the trip should start..

colton-nevs commented 1 year ago

I don't understand why the time would not matter if using PT timetables, unless there were an option to optimize for travel distance instead of time in traci.simulation.findIntermodalRoute()

lcodeca commented 1 year ago

When SAGA was implemented, traci.simulation.findIntermodalRoute() returned PT routes independently from the sim time or timetable. If now the implementation has changed, you are right. I don't know if/when I'll have time to validate this and change it if needed, but you are free to work on it and patch it! PRs are always welcome.

colton-nevs commented 1 year ago

Great! Much fewer errors now. Thank you