Figure 1. Process of ride-sharing pricing
Figure 2. Motivating example of pricing without fairness
- Ride-sharing is a transportation mode in which individual travelers share a vehicle for a trip.
- OnFairRP is an online fair ride-sharing pricing algorithm
- This project includes a ride-sharing simulator, the implementation of OnFair and other pricing schemes for comparison.
The motivating example in Figure 2 captures the real fairness issue in ride-sharing pricing. Though Alice and Bob have similar origins and same destination, Alice will be charged less since Alice’s neighborhood has more potential passengers to share the ride, which is unfair to Bob.
To deal with this issue, we consider the notion of individual fairness. Specifically, if two riders are similar (e.g., in terms of origin, destination, and departure time), they should receive similar discounts. Our algorithm, OnFairRP, guarantees individual fairness among riders in an online way. That is, for two riders arriving at different times, the difference between the discount of the latter rider and the one of any previous rider is bounded by K times the similarity of the two riders.
- scipy
- munkres
- networkx
- osmnx: e.g., to get a networkx graph of Haikou, China:
import osmnx as ox G = ox.graph_from_place('Haikou, Hainan, China', network_type='drive') ox.plot_graph(G, node_size=0)
- To install the dependent packages:
pip install -r requirements.txt
- Real-world data of ride request from DiDi Chuxing GAIA Initiative.
- Run with default settings:
python main_pricing.py
- Run with parameters specified:
python main_pricing.py --a 0.99 --K 0.16 --omega 0.5 --threshold 1.0
- Run with price computed by default settings:
python main.py
- Run with price computed with parameters specified:
python main.py --a 0.99 --K 0.16 --omega 0.5
- Run with price computed by a certain scheme:
python main.py --scheme OnFair
- Pricing
nohup bash a.sh >log.out 2>&1 & nohup bash omega.sh >log.out 2>&1 & nohup bash K.sh >log.out 2>&1 &
- Ride-sharing simulation
nohup bash cp_a.sh >log.out 2>&1 & nohup bash cp_omega.sh >log.out 2>&1 & nohup bash cp_K.sh >log.out 2>&1 &
python main.py --help

