Skip to the guide

Matching supply and demand: dispatch and assignment

AdvancedPattern5 pages

At a busy airport taxi rank, a marshal pairs the passengers queueing on the kerb with the taxis waiting in line. Mostly she waves the next taxi to the next passenger, but she glances down the whole queue first, so the family with six bags gets the people carrier. She hands each driver a numbered slip for one passenger, and a driver who doesn't pull forward within 15 seconds loses the slip to the next taxi. Her clipboard records which slip went to whom, so one taxi never carries two parties.

Passengers are ride requests and taxis are available drivers. The marshal is the matching service, waving the next taxi is greedy matching, and glancing down the queue is batch matching. The numbered slip is an offer with an ID and an expiry, and the clipboard is the driver's state row in a database. Interviewers listen for how you rank candidates and how you stop one driver getting two rides. The move: take the nearest available drivers from the location cells, rank them by time to arrive, and offer the ride to one at a time through a conditional update that expires.