OPt Exam Example 2
OPt Exam Example 2
Problem Set 2
Due: August 25th, 11:59am
Instructions. This problem set covers material related to linear programming. Solve all the S-
problems (standard). I have also included on challenge problem (i.e., an advanced problem). You
do not need to hand in the A-problems (advanced).
• Make sure your name and matric number is on each sheet of paper.
• Staple the pages together, and hand it in before class starts. Alternatively, if you submit
it late, you can put it in the envelope next to my office door (and send me an e-mail).
Alternatively, you may submit the problem set electronically on IVLE in the specified workbin.
• First, given an overview of your answer. Think of this as the executive summary.
• Third, give an example showing how your algorithm works. Draw a picture.
You may then give a proof of correctness, or explanation, of why your algorithm is correct, an
analysis of the running time, and/or an analysis of the approximation ratio, depending on what
the question is asking for.
Advice. Start the problem set early—some questions take time. Come talk to me about the
questions. (Different students have different questions. Some have questions about how to write a
good proof. Others need pointers of designing an algorithm. Still others want to understand the
material from lecture more deeply before applying it to the problem sets.) I’m here for you to talk
to.
Collaboration Policy. The submitted solution must be your own unique work. You may discuss
your high-level approach and strategy with others, but you must then: (i) destroy any notes; (ii)
spend 30 minutes on facebook or some other non-technical activity; (iii) write up the solution
on your own; (iv) list all your collaborators. Similarly, you may use the internet to learn basic
material, but do not search for answers to the problem set questions. Any similarity to other
students’ submissions will be treated as cheating.
1
Standard Problems (to be submitted)
S-1. Given a graph G = (V, E), an independent set is a subset of vertices I ⊆ V such that no two
nodes in I are neighbors. There is a close connection between finding a minimum vertex coverand
a maximum independent set. Assume that OPT-VC is an algorithm for finding a minimum vertex
cover. Then the following is an algorithm for finding a maximum independent set:
OPT-IS(V, E)
C = OPT-VC(V, E)
I = V \ C
return I
That is, if C is a minimum vertex cover, then V \ C is a maximum independent set. Assume
that Greedy-Match-VC is the 2-approximation algorithm for vertex cover that we studied in class.
Consider the following algorithm for independent set:
Greedy-IS(V, E)
C = Greedy-Match-VC(V, E)
I = V \ C
return I
Give an example graph where the approximation ratio for this algorithm is as bad as possible.
That is, draw a graph where the maximum independent set is very large, while the independent
set returned by the Greedy-IS algorithm is very small.
Notice what this demonstrates: even though it is easy to translate an optimal algorithm for
vertex cover into an optimal algorithm for independent set, it is very hard to turn an approximation
algorithm for vertex cover into an approximation algorithm for independent set.
max 2x + 4y where:
x − 2y ≥ 0
x + y/2 ≤ 10
x ≥ 0
y ≥ 0
Problem 2.a. Draw a picture illustrating the feasible region and identify the optimal solution.
Problem 2.b. Give a different objective function (for the same constraints) that would have a
different optimal solution.
Problem 2.c. Give an extra constraint such that, if added to the linear program above, the
feasible region is empty.
2
S-3. For each of the following two illustrations, give a linear program whose feasible region is
exactly the dark region depicted and which is optimized at the point indicated by the arrow. If no
such linear program exists, indicate IMPOSSIBLE and succinctly explain why. (You may assume
that all the vertices on the pictures are supposed to be at integer coordinates.)
Problem 3.a.
OPT
Problem 3.b.
OPT
3
S-4. The two best places in the galaxy to find water are Earth and Mars (where it can be found
frozen in the ice caps). Our two space stations, Argo (which orbits Saturn) and Volos (which orbits
Jupiter) both need water. Argo requires 18 rockets to deliver water every month, while Volos
requires 14 requires to deliver water every month.
Every month, we have the capability of launching 20 rockets of water from earth and 12 rockets
of water from Mars. Each rocket of water from Earth to Argo costs 1.2 billion dollars, while a
rocket of water from Earth to Volos costs 600 million dollars. Each rocket of water from Mars
to Argo costs 300 million dollars, and each rocket of water from Mars to Volos costs 800 million
dollars.
Problem 4.a. Write a linear program that determines the amount of water to be send from
Earth and Mars to Argo and Volos. Your goal is to minimize the total cost. (You do not need to
solve the linear program.) Comment on any issues that my arise in using the LP solution.
Problem 4.b. (Optional, but recommended.) Use the LP solver in Excel or Open Office to
solve the linear program above. There are many tutorials on the web explaining how to use the LP
solver. One example can be found at: http://tinyurl.com/pu34qa8.
S-5. (Triangles, Revisited) On the first problem set, we considered the problem of removing the
minimum number of edges from a graph in order that it be triangle free. Now we consider the
weighted version.
Assume you are given a weighted, undirected graph G = (V, E) where each edge e ∈ E is
assigned weight w(e) ≥ 0. The goal is to remove a set of edges D ⊆ E with minimum weight such
that the remaining graph G = (V, E \ D) has no triangles. Give a polynomial time algorithm for
solving this problem that is a 3-approximation of optimal, i.e., that returns a set of edges D that
weight at most 3-times the optimal set of edges needed to produce a triangle-free graph.
Problem 5.b. Show that your algorithm is correct, i.e., returns a set D such that the graph
(V, E \ D) is triangle-free.
4
Advanced Problems
These do not need to be submitted. They are intended to be particularly challenging. Optionally,
come talk to me about these during office hours.
A-1. Recall the classic NP-complete problem SAT in which you are given a formula and have
to decide if it is satisfiable. Here we consider MAX-SAT, where the goal is to satisfy as many
clauses as possible. We define the problem as follows:
• Let v1 , v2 , . . . , vn be a set of n boolean variables (i.e., each is either true or false). The
notation vi implies the negation of vi .
• A clause is a disjunction of variables or their negation, e.g., (v2 ∨ v7 ∨ v9 ∨ v12 ). (Recall that
the symbol ‘∨’ here indicates or.)
• The input to the problem is a sequence of clauses C1 , C2 , . . . , Cm .
• The goal is to satisfy as many clauses as possible, i.e., to assign boolean values to the variables
so as to maximize the number of satisfied clauses. Your algorithm your output the maximum
number of satisfies clauses.
For example, one input might look like:
(v1 ∨ v2 ∨ v3 )
(v3 ∨ v5 )
(v1 )
(v1 ∨ v3 ∨ v5 )
The answer to this problem instance is 3, because we can set v1 = true and v3 = true, satisfying
three clauses; but it is impossible to satisfy all four clauses.
The MAX-SAT problem is obviously NP-hard, as if you could solve MAX-SAT, you could
also satisfy SAT (i.e., by checking whether it is possible to satisfy all the clauses.) Our goal is
going to be to come up with an approximation algorithm.
We now give an integer linear program for solving MAX-SAT. Your job is to relax this ILP
and show how to use this ILP to develp a (1 − 1/e)-approximation algorithm.
For the purpose of notation, define Cj+ to be the non-negated variables in clause j, and c− j to
be the negated variables in clause j. For example, in the clause C1 = (v1 ∨ v2 ∨ v3 ∨ v4 ), we have
C1+ = {v1 , v2 } and C1− = {v3 , v4 }.
Consider the following integer linear program. The intent here is that each xi indicates whether
vi is true or false, and each zj indicates whether clause Cj is satisfied or not.
Xm
max zj
j=1
X X
∀j ∈ {1 . . . m} : zj ≤ xi + (1 − xi )
xi ∈Cj+ xi ∈Cj−
∀j ∈ {1 . . . m} : zj ∈ {0, 1}
∀i ∈ {1 . . . n} : xi ∈ {0, 1}
5
Problem 1.a. Prove that the ILP yields a correct solution for MAX-SAT.
Problem 1.b. Explain how to relax this ILP to find a randomized algorithm for MAX-SAT.
(Hint: think of each xi as a probability.)
Problem 1.c. Prove that the expected number of satisfied clauses is at least OP T /(1 − 1/e),
i.e., it is a (1 − 1/e) approximation algorithm. (Hint: Recall that for non-negative real numbers a,
b, c, we know that (abc) ≤ [(a + b + c)/3]3 . Also, recall that (1 − 1/x)x ≤ 1/e.)