Question 1 (40 points)
Howie Cramms needs to take n nal exams. If he studies h hours on Course #j,
h = 1, . . . , H, he can obtain p(h, j) grade points for that course. Suppose he is willing
to study H hours overall, and he wants to know t
We want to write down a solution as clear as possible, not one with the fewest
(a) x1, x2 = barrels of crude 1, crude 2 purchased (and distilled, of course),
(b) n, d1, d2 = barrels of naphta, distilled 1, distilled 2 made,
Consider the following scenario:
there are n customers and m candidate facility locations;
the distance of customer i to a facility at location j is dij ;
if we put a facility at location j, then at most uj and at least lj customers are to
For each of the following variants of the lot-sizing problem, decide whether the
following statements are true. If a statement is true, you must give a rigorous proof; if
it is not true, give a counterexample.
The statements that you need to evaluate, are
(a) f (n) is (g(n), but NOT O(g(n)
f (n) is not O(g(n): Suppose that f (n) is O(g(n). So there exist n0 and c such that
f (n) cg(n), n n0 . So in particular, for all even n n0 we have () n2 cn.
However, if n > maxcfw_n0 , c then (*) does not hold,
arcs is an cell-array of length n,
where n = no. of nodes in the graph.
arcscfw_i = nodes j s.t. (i,j) is an arc.
s = the starting node for the bfs.
marked, pred, order, dist are length n vectors.
marked(i) = 1,
Your friend has written an AMPL code, in which x1 , . . . , x5 are 0-1 variables, and
he wrote the following inequality in it:
x1 x2 x3 x4 x5 .
Needless to say, AMPL did not accept this.
Write an equivalent IP, which only uses linear inequalities.
Consider the post office scheduling problem in the third chapter of Winston. The
question: is it enough to have 25 employees to satisfy all demand?
Formulate as a shortest path problem.
Solve the shortest path problem by the LCA.
Recover the number of
Recall the graph G constructed for the fish-farming problem.
Let G0 denote the graph that arises from G by reversing the directions on the arcs.
Let q(t, i) be the length of the longest path from node (1, 10, 000) to node (t, i) in
Let h(t, i) be the
The algorithm will maintain a set of temporary, and permanent labels.
Step 0. Set perm(1) = +, temp(j) = c1j (1, j) A.
Step k for k 1: Let i be the node with maximum temporary label.
Make this label permanent.
For all nodes j with (i, j) A, set
Consider the version of the TSP, in which we have n cities, and the salesman must
visit exactly k of them, return to the home city of 1, and minimize the cost of the tour.
Consider city 1 to be the home city, which must be visited.
Modify the MTZ formulat
Let G = (V, A) be a directed graph with c ij nonnegative arc-capacities. The capacity
of a path is the minimum of the capacities of all the arcs in it. Say, if the path consists
of arcs (1, 2), (2, 3), (3, 4), then its capacity
A subvector of a vector a Rn is a vector of the form
(ak , ak+1 , . . . , a`1 , a` ),
where ` k.
You are given a Rn .
1. Describe a DP based algorithm to find the subvector of a in which the sum of
elements is maximum. Prove that the complexity of your al
Figure 1: Lotsizing instance
1. On the picture of Figure 1 the 3 numbers on an arc represent: fixed cost, variable
cost, and flow. That is, on a production arc, we have f t , ct , xt and on a storage
arc 0, ht , st .
Let G = (V, A) be a directed graph with c ij nonnegative arc-lengths. Consider the
following variant of Dijkstras algorithm:
Initialization. Let perm(s)=0. Let
csj , if(s, j) A
General step. Let i be the node with the maximum tempora
1. (when simply matching the socks).
Define for all i 6= j:
1 if sock i is worn with sock j
Then the IP is
j=1 xij = 1
xij = xji
xii = 0
xij cfw_0, 1
2. (when matching socks and deci
After finishing his laundry, Bob finds realizes that he has 20 different socks, none
of which really match any other (probably a familiar situation for most single males).
Many of them are sort of similar though, and some pairs would be less embarrassing
A company has a series of pipelines laid under the factory floor. The floor consists of a series of heavy square
slabs. It is desired to inspect each pipeline and this can be done if the company lifts one of the slabs directly
above each pipeline. The lay
The statement is not true: if ui (i = 2, . . . , n) with x is feasible, then so is ui + (i =
2, . . . , n) for any real number.
To make it true, we add the constraints: 2 ui n for all i.
Suppose that x defines a tour 1 = i1 , i2 , . . . , in = 1. Also sup
Construct an example of a graph where P is an s to k shortest path, with q an
intermediate node on P , and the subpath of P from s to q is not the shortest path.
(Hint: the graph will have to have a negative cycle).
AMO 124/4.3 If there is no fixed cost, then
= Cj (Li+1 + + Lj )
Ci+1 Li+1 + + Cj Lj
Therefore, if in the shortest path we take arc (i, j), we might as well take arcs (i, i +
1), (i + 1, i + 2), . . . , (j 1, j) instead. Hence, there is a shortest pat
1. The representation is the usual: Define the constants
(i = 1, 2, 3)
and the variables x, z, xi (i = 1, 2, 3). Use the constraints
x = v0 + x1 + x2 + x3
0 xi vi vi1 (i = 1, 2, 3)
z = f0 + s1 x1 + s2 x2 + s3 x3
Plug z into the ob