v3.0.0
Surge pricing per geohash cell.
- Trips record
pickup_cell(precision-5 geohash) and thesurge_multiplierthey were priced at (Alembic0003, indexed on(pickup_cell, requested_at)). - Demand per cell is a half-life-decayed sum of recent requests (60 s half-life by default); supply is the count of available, unexpired drivers in the cell. The multiplier is 1.0 while supply covers demand and otherwise
1 + 0.5 * (demand/supply - 1), capped at 3.0. Nothing is counted incrementally, both numbers are read from PostgreSQL and DynamoDB at request time, so replicas cannot drift. POST /ridesprices the trip against the demand already queued in its cell;GET /rides/surge?lat&lngquotes a point;GET /dispatch/heatmaplists every cell with recent demand or available supply, hottest first.- Configuration:
SURGE_HALF_LIFE_S,SURGE_STEP,SURGE_MAX_MULTIPLIER. - Tests: multiplier curve, decay arithmetic, a burst of requests in one cell driving the multiplier up through the HTTP service and cooling off ten minutes later, heatmap ordering through the dispatch service, migration 0003 up and down. 79 tests total.