Return to the Lecture Notes Index

15-111 Lecture 31 (Wednesday, April 8, 2009)

The Tunnels Problem

Imagine an underground mining system. It cosnists of a series of large caverns of precious ore connected to each other and also to the outside via tunnels.

These tunnels are round and come in all different widths. Some are much narrower than others. The width of the tunnel constrains the size of the cart that can be used to carry ore. In particular, in moving ore from place-to-place, one can use a cart no larger than the narrowest tunnel along the path.

Given a graph representing the tunnels and caverns/outside points and a starting and finishing point within the system, your job is to write a program that outputs a) the maximum cart width, and b) the path that the cart should use.

It is important to note that you are optimizing exactly for the width of the cart -- and not for the length of the path or the number of different tunnels or caverns traversed.

Thinking Through the Problem

On its face, this problem seems a lot like the shortest path or minimum spanning trees problems. In all three of these cases, we can find a solution by building a rooted spannign tree, while optimizing some aspect of the cost along the way.

In the case of the shortest-path problem, we were optimizing for the lowest cumulative cost. In the case of the minimum spanning tree problem, we were optimizing for the lowest marginal cost. In this case, we are optimizing for the biggest tunnel seen so far.

Perhaps, then, we can use a strategy similar to Dijkstra's or Prim's. Recall that these strategies were greedy node-to-node optimizations that proceeded in a breadth-first-like way from some prescribed starting point.

The Strategy and Argument

I propose that we construct this algorithm as we did Dijkstra's or Prim's, using the same table, and overall progression. But, this time, we use a different cost function. Recall that the cost function, the function for updating the cost entry in the table, is what distinguishes Dijkstra's from Prim's.