Docsity

Algorithm Design and Analysis: Steiner Tree Approximation and NP-Hard Problems - Prof. Cha, Assignments of Computer Science

Toggle sidebar
bg1
ECS 122A: Algorithm Design and Analysis Handout 1
UC Davis — Charles Martel February 21, 2008
Problem Set 4—Solutions
(20) Problem 1. a. We showed how to transform an arbitrary Steiner input (I) to a metric one
(I0) while ensuring that the cost of the optimal Steiner tree solution in I is not exceeded by
the cost of the optimal solution in I’. Additionally, wed like to prove that if we have an
approximation algorithm for finding a minimum cost steiner tree on the Steiner metric input,
then we also have an -approximation algorithm for finding a minimum cost steiner tree on
non-metric input.
We start by converting I to I’, then running the -approximation algorithm on I’. Then we
take our metric steiner solution tree T, and use it to find the non-metric steiner tree, T, for
I. For any edge (u,v) in I, the cost in G’ is no more than its cost in G, because we relabel
the edges in G with the value of the shortest path from u to v. Then, to find the non-metric
Steiner tree T from the metric Steiner tree T’, we look at all the edges in T’, and choose edge
(u,v) for the non-metric tree if it has the same weight in G and G, or we choose the shortest
path from u to v, if it has edge in G has less cost than in G. This algorithm might produce
cycles, so we would need to reduce edges to obtain a tree T”. This tree would have no more
cost than T’. And since the cost of an optimal solution in I does not exceed the cost of an
optimal solution in I, the -approximation is upheld.
More precisely, we have c(T00)≤c0(T0)≤c0(T0
OP T )≤c(TOP T ).
Where c() is the cost under original arc costs, c’ is the metric (shortest-path) costs, and
T0
OP T ,(TOP T are optimal trees for I’ and I respectively.
b. We are not guaranteed to get within a factor of 2 without using any of the vertices in S
for non-metric input. In the algorithm provided in section 3.1.1 of the text, a Hamiltonian
cycle on the vertices of R is obtained by traversing the Euler tour and short-cutting Steiner
vertices. In a metric graph, G, the shortcuts do not increase the cost of the tour, because
of the triangle inequality. However, in a non-metric graph, these shortcuts could potentially
increase the cost of the tour. This unknown cost increase is not guaranteed to provide a
solution within 2*OPT. Note in particular that converting to metric and back may use a
path (replacing an arc) and this path will in general include steiner vertices.
(30) Problem 2. Problem 3.2 in the text. We can convert this problem to a new G’ that is very
much like a Tree problem (MST when all vertices are in S or R, and steiner when not). We
first remove all edges between senders ( i) an optimal solution never uses those edges). Thus
an optimal solution has the following form: there are connected components (CC) consisting
of vertices in R (and vertices in neither S nor R), each CC has a single edge to a vertex in S .
Further, ii) this edge from a CC to siin S must be the cheapest edge that connects anything
in the CC to any vertex in S (otherwise we can improve the solution by swapping with that
cheaper edge).
Thus we can contract all the senders, S, into a single node s. Edges from R to sare as follows:
for each riin R, let cibe the minimum cost of any edge (ri, sj). Then the ciis the cost of
(ri, s) in G’ (or infinity if no such edge in G). Similarly, for a vertex uiin neither S nor R, let
cibe the minimum cost of any edge (ui, sj). Then the ciis the cost of (ui, s) in G’ .
pf3
pf4

Partial preview of the text

Download Algorithm Design and Analysis: Steiner Tree Approximation and NP-Hard Problems - Prof. Cha and more Assignments Computer Science in PDF only on Docsity!

ECS 122A: Algorithm Design and Analysis Handout 1 UC Davis — Charles Martel February 21, 2008

Problem Set 4—Solutions

(20) Problem 1. a. We showed how to transform an arbitrary Steiner input (I) to a metric one (I′) while ensuring that the cost of the optimal Steiner tree solution in I is not exceeded by the cost of the optimal solution in I’. Additionally, wed like to prove that if we have an  approximation algorithm for finding a minimum cost steiner tree on the Steiner metric input, then we also have an -approximation algorithm for finding a minimum cost steiner tree on non-metric input. We start by converting I to I’, then running the -approximation algorithm on I’. Then we take our metric steiner solution tree T, and use it to find the non-metric steiner tree, T, for I. For any edge (u,v) in I, the cost in G’ is no more than its cost in G, because we relabel the edges in G with the value of the shortest path from u to v. Then, to find the non-metric Steiner tree T from the metric Steiner tree T’, we look at all the edges in T’, and choose edge (u,v) for the non-metric tree if it has the same weight in G and G, or we choose the shortest path from u to v, if it has edge in G has less cost than in G. This algorithm might produce cycles, so we would need to reduce edges to obtain a tree T”. This tree would have no more cost than T’. And since the cost of an optimal solution in I does not exceed the cost of an optimal solution in I, the -approximation is upheld. More precisely, we have c(T ′′) ≤ c′(T ′) ≤ c′(T ′OP T ) ≤ c(TOP T ). Where c() is the cost under original arc costs, c’ is the metric (shortest-path) costs, and T ′OP T , (TOP T are optimal trees for I’ and I respectively. b. We are not guaranteed to get within a factor of 2 without using any of the vertices in S for non-metric input. In the algorithm provided in section 3.1.1 of the text, a Hamiltonian cycle on the vertices of R is obtained by traversing the Euler tour and short-cutting Steiner vertices. In a metric graph, G, the shortcuts do not increase the cost of the tour, because of the triangle inequality. However, in a non-metric graph, these shortcuts could potentially increase the cost of the tour. This unknown cost increase is not guaranteed to provide a solution within 2*OPT. Note in particular that converting to metric and back may use a path (replacing an arc) and this path will in general include steiner vertices.

(30) Problem 2. Problem 3.2 in the text. We can convert this problem to a new G’ that is very much like a Tree problem (MST when all vertices are in S or R, and steiner when not). We first remove all edges between senders ( i) an optimal solution never uses those edges). Thus an optimal solution has the following form: there are connected components (CC) consisting of vertices in R (and vertices in neither S nor R), each CC has a single edge to a vertex in S. Further, ii) this edge from a CC to si in S must be the cheapest edge that connects anything in the CC to any vertex in S (otherwise we can improve the solution by swapping with that cheaper edge). Thus we can contract all the senders, S, into a single node s. Edges from R to s are as follows: for each ri in R, let ci be the minimum cost of any edge (ri, sj ). Then the ci is the cost of (ri, s) in G’ (or infinity if no such edge in G). Similarly, for a vertex ui in neither S nor R, let ci be the minimum cost of any edge (ui, sj ). Then the ci is the cost of (ui, s) in G’.

With this transformation an MST in G’ is an optimal solution when all vertices are in S or R. When they are not, an optimal steiner tree with, R + s as required and others as steiner, solves the problem. Similarly, since our transformation preserves solution costs (the optimal solution in G’ for a steiner tree is the same as for the original problem, and any sensible solution (that doesn’t violate i), ii) above) is preserved, so our factor of 2 approximate steiner algorithm also works for this problem. To show the problem is NP-hard in general (when we have vertices that are neither senders or receivers), we show that Steiner-tree ≤p Sender-receivers. Given a steiner-tree problem,G = (V,E), V = R ∪ S, create a new graph G’ with the same vertex set, but designate one vertex in R as a sender and the rest in R as receivers. Now there is a one-one relationship between steiner trees for G and solutions in our new problem (any steiner tree connects all Receivers to the lone sender, and any subgraph that connects all Receivers to the sender is a tree), thus the minimum solution to the Send/receive problem solves the min. steiner tree.

(20) Problem 3. In class we discussed clique: given an undirected graph G=(V,E) find a set C of vertices such that every edge between vertices in C is 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 max. size set it is NP-hard. a) Suppse that k were fixed (that is we have the k-clique problem: given a graph G find a cover of size at least k) so the graphs change, but not k. Show that this is solvable in polynomial time. Since we are only interested in cliques of size k or more we can test all subsets of vertices of size k in O(nkk^2 ) = O(nk). This is a polynomial time algorithm since k is fixed. b) Clearly if we could solve the optimization version (find a smallest cover), 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. The max size clique is between one and n. To find the max-size of a clique, simply do a binary search on this range to find the largest k such that the yes-no problem (is there a clique of size k), returns yes. since this takes at most log n calls to the yes-no routine, if that ran in poly-time so would this binary search solution (note that a linear search using n calls is also polynomial time though slower) A fancier approach would find the actual solution (not just its size). Once you determine k, test which vertices go in the clique. For a vertex i try deleting it and all its touching edges. If the new graph has no k clique, then i is part of all optimal solutions, so add back to the graph. If the new graph still has a k-clique, i is not in all optimal solutions. so we can delete i, and all touching edges. After checking all vertices, we will be left with a k-clique.

(30) Problem 4. i. There are 3 different resources and two processors. This variation of the problem is type a), polynomial.

Let I be an instance of Set-Partition-Sum, I = {x 1 , x 2 ,... , xm}, and let B = (x 1 + x 2 +... + xm)/2 We construct I′^ an instance of Max-Single-Resource by letting job 1’s resource demand equal r 1 = x 1 , job 2’s resource command equal r 2 = x 2 and so forth, for all m values. We let the resource supply, R = B. We now show that the construction is valid.

If we have a solver for Max-Single-Resource, then the solver returns a set of jobs which is as close to R = B as possible. We build a Set-Partition- solver using our Max-Single-Resource as follows. Run the solver for Max-Single-Resource. Add up the ri values of the i jobs in the optimal set. If they sum to R then we answer yes, otherwise we answer no. Note that since in Set-Partition at least one of the two partition sets has n/2 or fewer elements, so when Set-Partition has a solution we can always find a set of at most n/2 jobs which use exactly R resources.

Using a dynamic programming solution like the one for Subset-Sum would also give us a solution for this problem. Note that we have to tweak the solution slightly to get sets of size n/2 or less. In the table let A[i, j] be the smallest cardinality set of the first i items which sum to exactly j. Then for the final row, we find the largest value j such that A[n, j] ≤ n/2. A similar dynamic programming algorithm can be found in chapter 35 of CLRS.