As we saw last week, a variety of scheduling problems can be solved by reducing them to the network flow problem. That is, we construct a network flow diagram and then argue that a maximum flow through this network provides an optimal solution to our original problem. In this discussion we will look at three incorrect examples of such reductions, and your job will be to explain the problems with them.
Here's an idea to solve this. If x is a student, make the capacity of the edge from c to x equal to 3n + 2. (We pick 3n so that no number of bonus points can be as desirable as scheduling another student.) Node x still has links to student x's three course choices, but now the edge to the first choice has capacity 3n + 2, the second choice has capacity 3n + 1, and the third choice has capacity 3n. Since we can put a greater flow tot he first choice, we might imagine that assignments to the first choice will be preferred. What goes wrong with an argument that maximum flow solves the problem?
We should first look at what goes right with this argument. For any schedule with z students and b bonus points, we have a flow in our graph of size 3nz + b. The problem comes when we try to argue that the maximum flow must lead to a valid schedule that optimizes the number of students and the bonus points. For one thing, any valid schedule where some student x gets their second or third choice leads to a flow that can be augmented by sending the extra one or two units of flow through the edge from x to x's first choice, at the same time most of the flow is going to the second or third choice. In this way, the reduction does not meet its stated goal of distinguishing among schedules with the same number of students. Beyond that, we don't know whether flows of less than 3n might be possible through some of the other edges, flows which wouldn't correspond to valid assignments at all. We only know that some optimal flow has integer amounts on each edge -- there is no reason why flow might be split among the three edges out of x, for example.
Here's an alleged way to solve the subset sum problem using network flow. The input to our problem is n positive integer values a1, a2, ..., an, and a target value T. We want to find a subset of the ai's that adds to exactly T. Let S be the sum of all the ai's.
We make our diagram as follows. The node set is {s, 1, 2, ..., n, x, y, t}. Node s has an edge of capacity ai to each node i. Node i has an edge of capacity ai to node x and another edge of capacity ai to node y. Finally, there is an edge from x to t of capacity T and an edge from y to T of capacity S - T. If there is a solution to the subset sum problem, there must be a flow in this diagram of size S, with the flow from the node i going to x if i is in the solution set and to y if it is not. Why doesn't this allow us to solve the subset sum problem?
There is no reason why the flow out of x may not be split with some going to x and some going to y. It is easy to construct an example where the subset sum problem has no solution, but the network flow diagram still has a valid flow of size S. For example, let n = 2, a1 = a2 = 2, and T = 3. There is no solution, but by sending one unit from node 2 to x and the other unit to y, we can get a flow of size S = 4 through the diagram.
Here's an ingenious idea for a network with O(n) nodes. For each student, we will make a node for every possible way their k classes can be divided up among timeslots. (For example, we might have "course 1 in timeslot D, course 2 in timeslot A, ..., course k in timeslot G".) The number of possible assignments is less than jk, a constant. Now from this node we branch k ways as before, but these nodes then connect only to sections (if any) from the appropriate timeslot. A valid schedule will lead to a proper flow -- does this solve the problem?
We have no guarantee that all the flow into the student's node will go to a single function node. If some of it goes to one function node and some to another, there is no reason why the courses assigned by these two flows should be compatible with each other -- for example, it might go to two classes that meet at the same time.
Last modified 19 November 2006