System Design: Ride-Hailing Pricing Engine
Context
Design a pricing engine for a ride-hailing platform that maximizes revenue while ensuring fairness to riders and drivers. The system must operate in real time, support experimentation, and provide transparent price breakdowns.
Requirements
-
API: Given a user trip request, return multiple candidate routes for the rider to choose.
-
Pricing: Compute a price for each candidate route using distance, duration, demand/supply, waiting time, and driver incentives.
-
Carpooling: When a rider opts into pooling, compute the rider’s price considering shared segments and detours.
-
Fairness: Enforce caps on surge multipliers, equitable pricing across neighborhoods, and provide transparent breakdowns.
-
Experimentation: Allow experimentation with pricing strategies and guardrails for safety.
-
Real-time updates: Handle live changes in demand and driver availability.
Deliverables
-
A high-level system design covering components, request/data flows, and storage.
-
Pseudocode for the core price calculation function with inputs, outputs, and complexity.
-
Discussion of trade-offs, assumptions, and a plan to validate fairness.