Ever wondered how the ride hailing apps calculate surge pricing for a rider at a given time ? How this pricing changes dynamically ? Lets examine a Business Case around this:
Prerequisites:
1. Rider ABC has the ride hailing service providers App installed in his mobile.
2. Rider ABC Mobile Internet and GPS is turned on.
3. Rider ABC Has a Start Destination and End Destination
Actors:
Rider ABC and Ride Hailing App System
Business Scenario:
Lets Assume in the below table Rider ABC is requesting a ride at DESTINATION A in order to reach DESTINATION B
Explanation:
In context to the above scenario ride hailing apps performs a check at DESTINATION A as below:
1. Scans the GPS Radius up to 2 KM around DESTINATION A to find the number of Available drivers.
2. Counts the Number of Available Drivers within the GPS radius up to 2 KM.
3. Scans the GPS Radius up to 2 KM around DESTINATION A to find the number of Riders Requests like ABC
4. Scans the Number of Riders Requests within the GPS radius up to 2 KM.
To perform steps 1 to 4 the app takes approximately around 15 seconds or as configured in the ride hailing apps system. The steps are again refreshed within 15 seconds till the RIDER ABC is convinced with the appropriate decline/increase in surge pricing.
Business Rules:
The Ride hailing app typically works in Demand vs Supply model and entities DRIVERS and RIDERS are the two important actors in this. So the Drivers and Riders count here is proportional to the Surge price multiplicative factor.
Business Rule 1: If No. of DRIVERS are equal to or more than number of RIDERS then there is no surge price charged.
Business Rule 2: If No. of DRIVERS ate less than number of RIDERS then a multiplicative surge factor is charged.
Business Rule 3: Surge Factor is a multiplicative factor charged to the Cumulative fare consisting of BASE FARE + (Ride Time Rate * Total Ride Time )+ (Per KM Rate * Total Number of KM).
The below table shows the price algorithm where:
Final Price = ((Base PRICE + (Ride Time Price * Ride Time) + (Per KM Price* Total KM)) * SURGE PRICE factor.
The algorithm can be used in both ways from Top to Bottom as well as Bottom to Top

This algorithm can be further extend to various cab categories where the CONSTANT DATA is changed in order to calculate the DYNAMIC DATA.
This Surge Algorithm is not limited to only CAB Aggregates but can be extended to any business with necessary adjustments in the appropriate factors like:
1. Appointment Booking with a Salon.
2. Movie Ticket Booking
3. Restaurant Delivery
4. Appointment Booking with a Doctor
The core heart of this algorithm is Demand Versus Supply.
