Skip to content

Apairery/OnFairRP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OnFairRP: Online Fair Ride-Sharing Pricing

Figure 1. Process of ride-sharing pricing


Figure 2. Motivating example of pricing without fairness

Overview

  • 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.

Fairness

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.

Dependencies

  • 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

Data Source

Usage

To price for ride requests using OnFair algorithm:

  • 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

To simulate the ride-sharing process with the ride requests and their corresponding price:

  • 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

To run with a set of values of a parameter for every scheme:

  • 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 &

To get more details of arguments of main.py or main_pricing.py:

python main.py --help

About

OnFairRP: Online Fair Ride-Sharing Pricing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published