Skip to content

Add Simulator, Estimated End Time, Vehicle Unassignments, and Stop Skipping - #7

Open
pamun1 wants to merge 26 commits into
mainfrom
develop-new-vehicles-requests-opt
Open

Add Simulator, Estimated End Time, Vehicle Unassignments, and Stop Skipping#7
pamun1 wants to merge 26 commits into
mainfrom
develop-new-vehicles-requests-opt

Conversation

@pamun1

@pamun1 pamun1 commented Oct 28, 2025

Copy link
Copy Markdown
Collaborator

This PR introduces several new features and improvements to the simulation system:

Major changes:

  • Added estimated_end_time to the Environment class to provide an estimation of the simulation duration to the visualizer.
  • Introduced a new Simulator class for controlling the simulation (simulate, pause, resume, stop).
  • Modified simulation logic to allow vehicle unassignments and to skip stops.
  • Developed FixedLineUnassignDispatcher, FixedLineReassignDispatcher and FixedLineSkipStopDispatcher.

pamun1 added 26 commits January 17, 2025 15:35
The configuration parameters associated with the simulation (i.e., time_step, speed, update_position_time_step and max_time) can now be accessed and modified from the Environment object through the attribute simulation_config that stores a SimulationConfig object.
The attribute estimated_end_time, that corresponds to an estimate of the end time of the simulation, was added to the class Environment.
With the new object Simulator, it is possible to create a simulation from the path to the directory containing the input files. Moreover, the methods pause(), resume() and stop() were added to Simulator and Simulation to let the user pause, resume and stop a simulation, respectively..
The visualizer has now access to the simulation and the environment through the "protected" attributes _simulation and _env respectively.
-The class ShuttleGreedyDispatcher was created. The class Simulator was modified to construct a simulation based on the ShuttleGreedyDispatcher.
-The class CoordinatesFromPolylineFile, that generates coordinates based on a polyline file was created.
-The submodule "coordinates" was created. All the Coordinates suclasses are now located in this module.
The attributes lon and lat were added to Location since all Location subclasses are expected to have these attributes.
These events are not needed anymore. The methods Simulation.pause() and Simulation.resume() should be used instead.
It was not possible to stop the simulation while on pause. It is now possible.
The directory appeared twice in the graph file path used by SimulationInitializerShuttle.
If the graph (network) file of a fixed line simulation is not available, it can now be generated by SimulationInitializerFixedLine.
If a vehicle was already at the origin stop of the next trip, a new stop with the same location was appended. This problem was corrected. A new stop is appended only if the trip origin is different from the current stop location of the vehicle.
The method DataCollector.clean_up, that is called at the end of a simulation, was added. It can be used to perform some clean up operations of the DataCollector before finishing a simulation.
The DataCollector objects now have a direct access to the simulation and the environment (as was the case for the Visualizer objects).
The attributes "lon" and "lat" were missing from the nodes of the graph network of shuttles. Instead of reading the network directly from the graph file, the method ShuttleDataReader.get_json_graph() is now used. Among other things, this method converts the "pos" attribute of each node into "lon" and "lat".
The attribute name was added to the class Vehicle.
The attribute capacity was added to the class Stop.
The method get_statistics of FixedLineDataAnalyzer now returns general information (not associated with the mode) about the vehicles and the trips.
The attribute tags was added to Request, Vehicle and Stop.
- During a connection, in PassengerAlighting, an Optimize event is not created if the next leg has already been assigned to a vehicle.
- Optimize events are now created directly in ActionEvent.process. The creation of an Optimize event is triggered according to the new status of an entity. A list of optimize triggering statuses can be passed to the Simulation as an argument.
- Unassignment has been moved from PassengerRelease to PassengerUnassignment.
- The example FixedLineUnassignDispatcher has been added.
- The Environment now tracks complete and non-complete trips and vehicles.
- A parameter has been added to determine whether the Route history (i.e., previous_stops and alighted_legs) is included or not in the deep copy of the State (passed to the Dispatcher). If the deep copy of the State is disabled, the Route history is always included.
@pamun1
pamun1 requested a review from legraina October 28, 2025 18:52
@pamun1 pamun1 self-assigned this Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant