{"id":13723839,"url":"https://github.com/sash-ko/simobility","last_synced_at":"2025-05-07T17:31:21.403Z","repository":{"id":44383905,"uuid":"235637092","full_name":"sash-ko/simobility","owner":"sash-ko","description":"simobility - light-weight mobility simulation framework. Best for quick prototyping","archived":false,"fork":false,"pushed_at":"2020-12-29T14:07:50.000Z","size":132505,"stargazers_count":42,"open_issues_count":6,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T04:00:46.717Z","etag":null,"topics":["autonomous-vehicles","fleet-management","mobility","mobility-modeling","optimization-algorithms","python","ridehailing","ridesharing","simulation-framework","simulator","transportation"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sash-ko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-22T18:23:34.000Z","updated_at":"2025-03-26T05:37:24.000Z","dependencies_parsed_at":"2022-07-14T14:17:19.768Z","dependency_job_id":null,"html_url":"https://github.com/sash-ko/simobility","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sash-ko%2Fsimobility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sash-ko%2Fsimobility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sash-ko%2Fsimobility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sash-ko%2Fsimobility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sash-ko","download_url":"https://codeload.github.com/sash-ko/simobility/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248344489,"owners_count":21088230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autonomous-vehicles","fleet-management","mobility","mobility-modeling","optimization-algorithms","python","ridehailing","ridesharing","simulation-framework","simulator","transportation"],"created_at":"2024-08-03T01:01:46.233Z","updated_at":"2025-05-07T17:31:21.336Z","avatar_url":"https://github.com/sash-ko.png","language":"Python","funding_links":[],"categories":["Energy Consumption","Consumption"],"sub_categories":["Mobility and Transportation"],"readme":"# simobility\n\n**simobility** is a light-weight mobility simulation framework. Best for quick prototyping\n\n**simobility** is a human-friendly Python framework that helps scientists and engineers to prototype and compare fleet optimization algorithms (autonomous and human-driven vehicles). It provides a set of building blocks that can be used to design different simulation scenarious, run simulations and calculate metrics. It is easy to plug in custom demand models, customer behavior models, fleet types, spatio-temporal models (for example, use [OSRM](http://project-osrm.org/) for routing vehicles and machine learning models trained on historical data to predict [ETA](https://en.wikipedia.org/wiki/Estimated_time_of_arrival)).\n\n### Motivation\n\nCreate an environment for experiments with machine learning algorithms for decision-making problems in mobility services and compare them to classical solutions.\n\n\u003cimg src=\"./examples/moving_vehicles.gif\" width=\"35%\" align=\"right\"\u003e\n\nSome examples:\n* [Deep Reinforcement Learning with Applications in Transportation](https://outreach.didichuxing.com/tutorial/AAAI2019/)\n\n* [T. Oda and C. Joe-Wong, \"Movi: A model-free approach to dynamic fleet management\". 2018](https://arxiv.org/pdf/1804.04758.pdf)\n\n* [A. Alabbasi, A. Ghosh, and V. Aggarwal, \"DeepPool: Distributed model-free algorithm for ride-sharing using deep reinforcement learning\", IEEETrans. Intelligent Transportation Systems (to appear). 2019](https://arxiv.org/pdf/1903.03882)\n\n* [C Wang,Y Hou, M Barth, \"Data-Driven Multi-step Demand Prediction for Ride-hailing Services Using Convolutional Neural Network\". 2019](https://arxiv.org/pdf/1911.03441.pdf)\n\n* [J. Ke, F. Xiao, H. Yang, and J. Ye. Optimizing online matching for ride-sourcing services with multi-agent deep reinforcement learning. 2019](https://arxiv.org/abs/1902.06228)\n\n### Installation\n\n`pip install simobility`\n\n### Contributions and thanks\n\nThanks to all who contributed to the concept/code:\n\n* [Steffen Häußler](https://www.linkedin.com/in/steffenhaeussler/)\n* [Stephen Privitera](https://www.linkedin.com/in/stephen-privitera/)\n* [Sultan Imanhodjaev](https://www.linkedin.com/in/imanhodjaev/)\n* [Yábir Benchakhtir](https://www.linkedin.com/in/yabirgb/)\n\n### Examples\n\n[Grid world simulation](./examples/grid_world.py)\n\n[Simple simulation](./examples/simple_simulation.py)\n\n[Taxi service](./examples/taxi_service.py)\n\n[Log example](./examples/simulation_output_example.csv)\n\n\n### Benchmarks\n\nBenchmark simulations with `LinearRouter` and `GreedyMatcher`. Simulations will run slower with `OSRMRouter` because `OSRM` cannot process requests as fast as the linear router.\n\n_Processor: 2,3 GHz Dual-Core Intel Core i5; Memory: 8 GB 2133 MHz LPDDR3_\n\nSimulated time | Simulation step | Vehicles | Bookings per hour | Execution time | Generated events | Pickup rate\n--- | --- | --- | --- | --- | --- | ---\n|1 hour | 10 sec | 50 | 100 | 4 sec | 1082 | 96.97%\n|24 hours | 1 min | 50 | 100 | 12 sec | 23745 | 88.37%\n|24 hours | 10 sec | 50 | 100 | 20 sec | 23880 | 88.84%\n|12 hours | 10 sec | 200 | 100 | 18 sec | 13337 | 99.89%\n|12 hours | 10 sec | 50 | 500 | 31 sec | 40954 | 53.92%\n|12 hours | 10 sec | 200 | 500 | 46 sec | 65444 | 99.3%\n|12 hours | 10 sec | 1000 | 500 | 1 min 48 sec | 66605 | 99.98%\n|1 hour | 1 min | 1000 | 1000 | 14 sec | 11486 |\n|1 hour | 10 sec | 1000 | 1000 | 18 sec | 11631 |\n|24 hours | 1 min | 1000 | 1000 | 5 min 1 sec | 262384 |\n|24 hours | 10 sec | 1000 | 1000 | 6 min 20 sec | 262524 |\n\nA heuristic that allows estimating a maximum number of booking a fleet of N vehicles can handle: assume that an avarage trip duration is 15 minute, than 1 vehicle can not more then handle 4 booking per hour and the upper limit for 1000 vehicles is 4000 bookings per hour.\n\n### Metrics example\n\n```json\n{\n    \"avg_paid_utilization\": 63.98,\n    \"avg_utilization\": 96.87,\n    \"avg_waiting_time\": 292.92,\n    \"created\": 3998,\n    \"dropoffs\": 589,\n    \"empty_distance\": 640.37,\n    \"empty_distance_pcnt\": 33.67,\n    \"fleet_paid_utilization\": 63.98,\n    \"fleet_utilization\": 96.87,\n    \"num_vehicles\": 50,\n    \"pickup_rate\": 15.48,\n    \"pickups\": 619,\n    \"total_distance\": 1902.04,\n}\n```\n\n### Simulation logs\n\nThe are multiple ways to collect simulation log - use CSV or InMemory log handler or implement your own handler: [loggers](https://github.com/sash-ko/simobility/blob/master/simobility/core/loggers.py)\n\n\nRead CSV logs with pandas:\n\n```python\nimport pandas as pd\n\ndata = pd.read_csv(\n    \"simulation_output.csv\",\n    sep=\";\",\n    converters={\"details\": lambda v: eval(v)},\n)\n\ndetails = data.details.apply(pd.Series)\n```\n\n### Run OSRM\n\n```bash\nwget http://download.geofabrik.de/north-america/us/new-york-latest.osm.pbf\ndocker run -t -v \"${PWD}:/data\" osrm/osrm-backend osrm-extract -p /opt/car.lua /data/new-york-latest.osm.pbf\ndocker run -t -v \"${PWD}:/data\" osrm/osrm-backend osrm-partition /data/new-york-latest.osrm\ndocker run -t -v \"${PWD}:/data\" osrm/osrm-backend osrm-customize /data/new-york-latest.osrm\ndocker run -d -t -i -p 5010:5000 -v \"${PWD}:/data\" osrm/osrm-backend osrm-routed --algorithm mld /data/new-york-latest.osrm\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsash-ko%2Fsimobility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsash-ko%2Fsimobility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsash-ko%2Fsimobility/lists"}