A Python simulation of a bike share such as Citibike. The goal is to practice my OOP skills by creating a simple bike share simulation. There are only a handful of objects in this project.
- Bike
- Dock
- Station
- Simulation
- Bike share system is initialized with a predetermined simulation run time
(in minutes) that can be changed in
__main__.py
, 9 stations, 135 docks, and 80 bikes. Each station is located in a 3x3 grid that will help calculate how long trips are between stations. - Every minute of the simulation, the probability of customers renting a bike is simulated as a Poisson process, and anywhere from about 0-4 (possible although very unlikely 4 people will check out) people can potentially check out a bike.
- When a customer does check out a bike, they do so from a randomly chosen station. That customer then travels directly to another randomly chosen station in the system. When they arrive, they can check in the bike if there are any available docks. If not, they have to travel to another station and try there. By "directly" I mean that there are no joy rides that for instance could result in someone starting and ending at the same dock. Furthermore, this simplifies the calculation of travel time, as it is assumed that any trip between two locations is purely a function of distance and speed which can be predetermined.
- When a customer checks a bike in or out, the time is recorded along with the station id number.
- At the end of the simulation, a full log of all activity is printed for review.
Clone this repo and ensure a Python3 environment with the required packages. You must be in the directory containing
bike-share-sim
in order to run
python bike-share-sim
A summarized log of activity each minute will be printed out, as well as some statistics about the entire simulation at the end.
I would love to build the following once the base simlation is done.
- Include command line inputs for the size of the simulation.
- Build a simple GUI to visualize the demonstration
- Incorporate other bike types such as ElectricBike (and thus perhaps ElectricDock)