Skip to content

thisistayeb/ride-Hailing-drivers-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drivers Simulation in ride-hailing

This script simulates one or multiple drivers of ride-hailing on a working day.

How it works?

The simulation works on strong and super-optimistic assumptions.

  1. Driver(s) only work in a district of central Tehran, where most companies and businesses are located.

  2. There is an infinite demand in this district.

  3. Driver(s) only accept trips inside this district.

  4. Passengers are at most 1 KM away from the driver and if traffic is supper-heavy and the passenger is too far than 10 minutes, the driver cancels the trip.

After running the script, the driver(s) initial location will be randomly chosen in a district in the center of Tehran, and they start the work day immediately. A passenger's location will be chosen uniformly randomly from a 1 km circle around the driver, and the destination of the passenger will be chosen uniformly from the district in central Tehran, which is more than 2 Km away from the passenger. There is only a 30 minutes rest time, and each driver is chosen randomly between 4-6 hours after starting time.

The price of trips collect from two main rides-hailing companies in Iran, (Snapp & Tapsi), and real-time traffic data will obtain from Neshan Company.

Usage

1. Number of drivers

Indicate the number of drivers in main.py by NUMBER_OF_DRIVERS variable.

2. Authentication

The request's header of Snapp/Tapsi API and the API key of Neshan should define as environment variables. Snapp's authentication could be obtained from Snapp's webapp and Tapsi's authentication could be obtained their webapp.

Example of Snapp/Tapsi's header avilable at: Snapp, Tapsi.

3. Run script

Run python main.py

4. Trajectory log files

The trajectory log file of each driver could be found in src/log directory.

Subtools

  • summary.py, generates a summary of the log file of a driver.

  • summary_for_all_logs.sh run summary.py for all logs in the log directory.

how to use: in log directory, run ./summary_for_all_logs.sh

Licensing

This project is licensed under the BSD license. More info at LICENSE.