

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


ECS 222B: Algorithm Design and Analysis Handout 1 UC Davis — Charles Martel February 5, 2008
in the CS office. No late homeworks will be accepted.
(25) Problem 1. Suppose we have a flow network with arc lower bounds (so each arc (i, j) has a capacity ci,j and a lower bound li,j and the flow fi,j on the arc must satisfy 0 ≤ li,j ≤ fi,j ≤ ci,j (in addition to the normal flow conservation constraints at each node). Prove that if all the li,j , ci,j values are integers, then a) if there exists a feasible flow, then there also exists an integer feasible flow. First observe that all our flow algorithms (A-path or preflow-push) have the property that at each step they produce an integer flow if the capacities are integral. Even with lower bounds, if the current flow is integer, the capacities in Gf are integral (difference between ints is an int). Our solution algorithm started by setting each arc to its lower bound (an integer) and the new flows on dummy arcs are thus also integers (to balance nodes). From our observation above as we find a max-flow in the network with dummy nodes, we maintain an integer flow, so if we find a feasible flow at the end it is integer. b) If there exists a feasible flow, then there exists a maximum (feasible) flow which is also integral. Since we start by finding a feasible integer flow (by a) and maintain this as we augment (by our observation). We get a max. integer flow at the end.
(25) Problem 2. (Problem 6.5, page 199) Statistical security of data. Describe a polynomial- time algorithm for identifying all the unprotected elements of the matrix and their values.
This problem can be transformed into a network flow problem. We construct a network G = (Vr ∪ Vc ∪ {s, t}, E) as follows. For each row i of table D we create a node vi ∈ Vr. For each column j of D we create a node vj ∈ Vc. We also create a source node s and a sink node t. For each pair of nodes (vi, vj ) in which vi ∈ Vr, vj ∈ Vc and (i, j) undisclosed we create a directed arc (vi, vj ) ∈ E and set uij = min{r(i), c(j)}. If entry (i, j) is disclosed in the table, we subtract its value from ri and from cj (thus the final r′ i, c′ j values reflect the remaining row/column sums produced by undisclosed values). We create a directed arc from s to each vi ∈ Vr with upper bounds equal to r′(i). We create a directed arc from each vj ∈ Vc to t with upper bound equal to c′(j). Now a max flow in the network from s to t corresponds to an assignment of values to undis- closed elements in table D, with dij equal to the flow on arc (vi, vj ). A suppressed element (i, j) is unprotected iff only one value of dij is consistent with the row and column sums and the disclosed elements, in other words iff the flow xij on arc (vi, vj ) is the same in all feasible flows.
2 ECS 222B Handout 1: Problem Set 2 Solutions—
Given a feasible flow f and corresponding residual graph Gf , we have the following observation to check whether xij is the same in all feasible flows: we can increase or decrease xij by one unit iff there is an augmenting cycle in Gf containing this (forward or backward) arc (this follows directly from what we know about min-cost flows: if we were to give the edge (i, j) a high cost, there would be a negative cost augmenting cycle in Gf if an alternate flow existed). To find all such elements we can do a BFS in Gf after removing arcs between vi and vj to check whether vi and vj can be reached from each other. If neither vi nor vj can be reached, element (i, j) is unprotected. For each pair of nodes in Gf (i.e. each element in the table) it takes O(rc) time for the BFS, in which p, q are the size of the table. To check all elements in the table it takes O(r^2 c^2 ) time. It takes O(rc(r + c)^2 ) time to build a feasible flow, which is the overall time bound.
(15) Problem 3. Our family is n + 2 node networks. s has an arc to each of the other n nodes, and each has an arc to t. All capacities are 1. Any S, T cut has a capacity of n (each node contributes 1 to the cut whether on S or T side). Thus there are 2n^ cuts of capacity n.
(30) Problem 4. a) We reset each deadline to di + L and then run the algorithm for these new deadlines. Same run-time as the original scheduling algorithm. b) Basic idea is to do a binary search over the L values. Try L = 0, 1 , 2 , 4 ,... , 2 k^ where 2k^ is the first to work. Then can do binary search over the range 2k−^1 , 2 k. Note however, that even with all other data integer, the optimal value of L need not be integer. For example, m = 2, and we have three jobs release at time zero with deadlines of 1 ti = 1, the optimal value of L is .5 (since we can finish all jobs by time 1.5). What you can do is to use the binary search to find the correct flow network to use (note that when di + L = rj for some i, j pair the intervals, and thus the structure of the flow network changes). Once you have the correct flow network, consider a value of L which is too small to work. Then you can look at the min-cut, S, T associated with a maximum flow the network for that lateness value L. The capacity of S, T will be a function of L, so you can compute the value of L that makes the capacity of S, T equal to the flow needed (the sum of the ti values). Update to this flow value, and then try again (you may find a new min-cut now). This approach will also solve part c) since it does not assume integer values.