-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Look at the file main.py
. This file sets up an example simulation, runs it and visualizes the result. On Linux, go to the source code directory and execute the python script like this:
$ ./main.py
Using Windows and VS code, open main.py
and press F5 to start with debugging, or Ctrl+F5 to start without debugging.
The system is divided into the following main parts:
- Global settings (file
settings.py
) - Initial state generation (subdirectory
init_state
) - Ideal state calculation (subdirectory
ideal_state
) - Event simulator (subdirectory
sim
) - Policy (subdirectory
policy
) - Visualization (subdirectory
visualization
) - GUI dashboard (subdirectory
GUI
)
Create a class that inherits the Policy class found in policy/policy.py
. The get_best_action()
method must be reimplemented by your subclass and is responsible for returning the next action for the given service vehicle. The method gets a reference to the simulator object, from which all simulator state can be obtained.
Some useful functions and objects found through the simulator object:
-
simul.day()
: Return current day -
simul.hour()
: Return current hour -
simul.state
: State-object representing the entire city bike state (sim/State.py
) -
simul.state.vehicles
: List of all service vehicles (sim/Vehicle.py
) -
simul.state.stations
: List of all stations (sim/Station.py
) -
simul.state.depots
: List of all depots (sim/Depot.py
) -
simul.state.get_all_scooters()
: List of all bikes and electric scooters (sim/Bike.py
andsim/Scooter.py
) -
simul.state.get_distance()
: Get distance between two stations -
simul.state.get_trip_speed()
: Get average bike speed between two stations
Your simulation object has a member metrics
(sim/Metric.py) where various data about the simulation is collected.
The dashboard was developed as an aid for testing of various simulators and components. It is currently an incomplete prototype, and can be modified and extended after concrete wishes from users. Many of the FOMO simulator operations take several minutes, and for operations that take more than 1-2 seconds a sound signal is given upon completion. The flag settings.USER_INTERFACE_MODE
must be set to "GUI"
to start the dashboard.