Docsity

4 Problems on Algorithm Design - Assignment 4 | ECS 122A, Assignments of Computer Science

Toggle sidebar
bg1
ECS 122A: Algorithm Design and Analysis Handout 1
UC Davis — Charles Martel Feb. 15, 2008
Problem Set 4—Due Monday, February 25, noon
H
¯omework Info Homeworks are to be turned in to me, electronically, in class, or put in my mailbox
in the CS office. No late homeworks will be accepted.
(20) Problem 1. In class we showed we can convert a Steiner tree input that doesn’t satisfy the
triangle inequality to one that does satisfy it and this preserves approximations (we can use an
approximate solution in the transformed setting to get a good approximation for the original
setting).
a) Show that the theorem we proved in class on transforming an arbitrary Steiner input to a
metric one shows that if we have an -approximation algorithm for metric Steiner tree, then
we also get an -approximation algorithm for any Steiner problem (mertric or not)
b) The factor of 2 approximation algorithm for Steiner tree uses a MST on the required
vertices R. Does this mean that we can get within a factor of 2 without using any of the
vertices in S for all inputs (metric or not)? Justify your answer.
(30) Problem 2. Problem 3.2 in the text.
(20) Problem 3. In class we discussed clique problem: given an undirected graph G=(V,E) find
a set C of vertices such that every pair of vertices in C is connected by an edge in E.
In the yes-no version where we require the set Cto be of size at least k(where kis an input to
the problem), then the problem is NP-complete. If we want the largest size set it is NP-hard.
a) Suppse that kwere fixed (that is we have the k-vertex clique problem: given a graph G
find a clique of size at most k) so the graphs change, but not k. Show that this is solvable in
polynomial time.
b) Clearly if we could solve the optimization version (find a largest clique), we could also
solve the yes-no version. Show the reverse is also true: if we can solve the yes-no version in
polynomial time, we can also solve the optimization version in polynomial time. (hint: you
may need multiple calls to the yes-no solver).
This second result shows that either both versions are in P, or neither is.
(30) Problem 4. Consider the following scheduling problem. You are given njobs which you
want to schedule on pprocessors. There are a total of kresources which a job might need to
be able to be run (think of these as memory, disk, ...). Ri, i = 1,2, ..., k is the total amount of
resource iavailable. ri,j is the amount of resource irequired by job jin order to be executed.
A set of jobs S, |S| ≤ p, can all be run simultaneously only if for each resource i, the sum of
ri,j ≤Riwhen summed over all jobs jin S (the total amount of resource iavailable meets
the total amount demanded by all jobs in S).
Each job requires one unit of processing time, and the goal is to complete the final job as
early as possible. There are no release times, deadlines or precedence constraints.
pf2

Partial preview of the text

Download 4 Problems on Algorithm Design - Assignment 4 | ECS 122A and more Assignments Computer Science in PDF only on Docsity!

ECS 122A: Algorithm Design and Analysis Handout 1 UC Davis — Charles Martel Feb. 15, 2008

Problem Set 4—Due Monday, February 25, noon

H

omework Info Homeworks are to be turned in to me, electronically, in class, or put in my mailbox

in the CS office. No late homeworks will be accepted.

(20) Problem 1. In class we showed we can convert a Steiner tree input that doesn’t satisfy the triangle inequality to one that does satisfy it and this preserves approximations (we can use an approximate solution in the transformed setting to get a good approximation for the original setting). a) Show that the theorem we proved in class on transforming an arbitrary Steiner input to a metric one shows that if we have an -approximation algorithm for metric Steiner tree, then we also get an -approximation algorithm for any Steiner problem (mertric or not) b) The factor of 2 approximation algorithm for Steiner tree uses a MST on the required vertices R. Does this mean that we can get within a factor of 2 without using any of the vertices in S for all inputs (metric or not)? Justify your answer.

(30) Problem 2. Problem 3.2 in the text.

(20) Problem 3. In class we discussed clique problem: given an undirected graph G=(V,E) find a set C of vertices such that every pair of vertices in C is connected by an edge in E. In the yes-no version where we require the set C to be of size at least k (where k is an input to the problem), then the problem is NP-complete. If we want the largest size set it is NP-hard. a) Suppse that k were fixed (that is we have the k-vertex clique problem: given a graph G find a clique of size at most k) so the graphs change, but not k. Show that this is solvable in polynomial time. b) Clearly if we could solve the optimization version (find a largest clique), we could also solve the yes-no version. Show the reverse is also true: if we can solve the yes-no version in polynomial time, we can also solve the optimization version in polynomial time. (hint: you may need multiple calls to the yes-no solver). This second result shows that either both versions are in P, or neither is.

(30) Problem 4. Consider the following scheduling problem. You are given n jobs which you want to schedule on p processors. There are a total of k resources which a job might need to be able to be run (think of these as memory, disk, ...). Ri, i = 1, 2 , ..., k is the total amount of resource i available. ri,j is the amount of resource i required by job j in order to be executed. A set of jobs S, |S| ≤ p, can all be run simultaneously only if for each resource i, the sum of ri,j ≤ Ri when summed over all jobs j in S (the total amount of resource i available meets the total amount demanded by all jobs in S). Each job requires one unit of processing time, and the goal is to complete the final job as early as possible. There are no release times, deadlines or precedence constraints.

2 ECS 122A Handout 1: Problem Set 4—Due Monday, February 25, noon

For each of the following settings show that the problem is: a) polynomial by giving a polyno- mial time algorithm, or b) weakly NP-hard by proving it is NP-hard and giving a psedopoly- nomial algorithm, or c) strongly NP-hard by giving a strong NP-hardness proof. i) There are 3 different resources and two processors. ii) There is only one resource and n/2 processors. iii) Same as ii) except our goal is to schedule a set of jobs which uses as much of the single resource as possible (thus we want a set of jobs which ideally uses a total of R 1 units of resource 1, or if not, uses as close to this as possible).