Break ties between equal-cost routes

Keep the names of states and actions distinct. · 195 words

Route search keeps partial routes in a frontier, a collection of candidates to explore next. Each route has an accumulated cost, such as minutes. If two candidates have equal cost, a tie-breaking rule decides which one is expanded first. For a trip from Central Station to the Science Museum, a bus for 4 minutes followed by a train for 6 minutes costs 10 and requires one transfer. A direct train also costs 10 and requires zero transfers. With fewer transfers as the tie-break, the direct train is selected. The tie-break changes exploration order, not the route's cost.

Another example is a courier choosing between Market and Pier. Roads X and Y are both 8 kilometers, so distance alone cannot rank them. A secondary rule can prefer the road with fewer traffic lights, then use alphabetical road names if still tied. If X has four lights and Y has two, Y is chosen; if both have two, Y wins only when Y comes first alphabetically. These secondary scores must be stored with each route. If arrival time is the real goal, expected waiting time belongs in the primary cost instead of being hidden in a tie-break.

Check your recall

For the 10-minute museum trip, which route wins under the fewer-transfers tie-break, and does the tie-break change the cost?

Check your answer

The direct train wins because it requires zero transfers, while the bus-and-train route requires one. No, the tie-break only changes which equal-cost route is explored first. Both routes still cost 10 minutes.

Sources and credits

Original KeyTouch lesson. Background reading · UC Berkeley · Introduction to Artificial Intelligence.