url
stringclasses
71 values
filename
stringclasses
71 values
success
bool
1 class
page_count
int64
1
917
pdf_text
stringlengths
0
4.81k
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
from the algorithm, which in such cases would increment the flow by an integer amount on each iteration. Hence integrality comes for free in the maximum-flow problem. Unfortunately, this is the exception rather than the rule: as we will see in Chapter 8, it is a very difficult problem to find the optimum solution (or for t...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 7.9 By design, dual feasible values ≥primal feasible values. The duality theorem tells us that moreover their optima coincide. Primal Primal feasible This duality gap is zero opt Dual feasible Objective value opt Dual To start with, these yi’s must be nonnegative, for otherwise they are unqualified to multiply in...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 7.10 A generic primal LP in matrix-vector form, and its dual. Primal LP: max cT x Ax ≤b x ≥0 Dual LP: min yT b yT A ≥cT y ≥0 Figure 7.11 In the most general case of linear programming, we have a set I of inequalities and a set E of equalities (a total of m = |I| + |E| constraints) over n variables, of which a su...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
When the primal is the LP that expresses the max-flow problem, it is possible to assign interpretations to the dual variables that show the dual to be none other than the minimum- cut problem (Exercise 7.25). The relation between flows and cuts is therefore just a specific instance of the duality theorem. And in fact, the...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Now suppose the two of them play this game repeatedly. If Row always makes the same move, Column will quickly catch on and will always play the countermove, winning every time. Therefore Row should mix things up: we can model this by allowing Row to have a mixed strategy, in which on each turn she plays r with probabil...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
to announce his or her strategy in advance! What’s more, this remarkable property is a con- sequence of—and in fact equivalent to—linear programming duality. Let’s investigate this with a nonsymmetric game. Imagine a presidential election scenario in which there are two candidates for office, and the moves they make cor...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
In LP form, this is min w −3y1 + y2 + w ≥0 2y1 −y2 + w ≥0 y1 + y2 = 1 y1, y2 ≥0 The crucial observation now is that these two LPs are dual to each other (see Figure 7.11)! Hence, they have the same optimum, call it V . Let us summarize. By solving an LP, Row (the maximizer) can determine a strategy for herself that gua...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 7.12 A polyhedron defined by seven inequalities. x1 x3 x2 1⃝ 4⃝ 2⃝ 3⃝ 5⃝ 6⃝ 7⃝ A B C max x1 + 6x2 + 13x3 x1 ≤200 1⃝ x2 ≤300 2⃝ x1 + x2 + x3 ≤400 3⃝ x2 + 3x3 ≤600 4⃝ x1 ≥0 5⃝ x2 ≥0 6⃝ x3 ≥0 7⃝ 7.6.1 Vertices and neighbors in n-dimensional space Figure 7.12 recalls an earlier example. Looking at it closely, we see ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
7.6.2 The algorithm On each iteration, simplex has two tasks: 1. Check whether the current vertex is optimal (and if so, halt). 2. Determine where to move next. As we will see, both tasks are easy if the vertex happens to be at the origin. And if the vertex is elsewhere, we will transform the coordinate system to move ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
y2 y1 x u Specifically, if one of these enclosing inequalities is ai · x ≤bi, then the distance from a point x to that particular “wall” is yi = bi −ai · x. The n equations of this type, one per wall, define the yi’s as linear functions of the xi’s, and this relationship can be inverted to express the xi’s as a linear fu...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 7.13 Simplex in action. Initial LP: max 2x1 + 5x2 2x1 −x2 ≤ 4 1⃝ x1 + 2x2 ≤ 9 2⃝ −x1 + x2 ≤ 3 3⃝ x1 ≥ 0 4⃝ x2 ≥ 0 5⃝ Current vertex: { 4⃝, 5⃝} (origin). Objective value: 0. Move: increase x2. 5⃝is released, 3⃝becomes tight. Stop at x2 = 3. New vertex { 4⃝, 3⃝} has local coordinates (y1, y2): y1 = x1, y2 = 3 + x1...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
7.6.3 Loose ends There are several important issues in the simplex algorithm that we haven’t yet mentioned. The starting vertex. How do we find a vertex at which to start simplex? In our 2D and 3D examples we always started at the origin, which worked because the linear programs happened to have inequalities with positi...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
close to one another? Unboundedness. In some cases an LP is unbounded, in that its objective function can be made arbitrarily large (or small, if it’s a minimization problem). If this is the case, simplex will discover it: in exploring the neighborhood of a vertex, it will notice that taking out an inequality and addin...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
220
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Gaussian elimination Under our algebraic definition, merely writing down the coordinates of a vertex involves solving a system of linear equations. How is this done? We are given a system of n linear equations in n unknowns, say n = 4 and x1 −2x3 = 2 x2 + x3 = 3 x1 + x2 −x4 = 4 x2 + 3x3 + x4 = 5 The high school method f...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Linear programming in polynomial time Simplex is not a polynomial time algorithm. Certain rare kinds of linear programs cause it to go from one corner of the feasible region to a better corner and then to a still better one, and so on for an exponential number of steps. For a long time, linear programming was considere...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
true AND NOT AND OR OR NOT output false true The CIRCUIT VALUE problem is the following: when the laws of Boolean logic are applied to the gates in topological order, does the output evaluate to true? There is a simple, automatic way of translating this problem into a linear program. Create a variable xg for each gate ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Another parting thought: by what other means can the circuit evaluation problem be solved? Let’s think—a circuit is a dag. And what algorithmic technique is most appropriate for solving problems on dags? That’s right: dynamic programming! Together with linear programming, the world’s two most general algorithmic techni...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Exercises 7.1. Consider the following linear program. maximize 5x + 3y 5x −2y ≥0 x + y ≤7 x ≤5 x ≥0 y ≥0 Plot the feasible region and identify the optimal solution. 7.2. Duckwheat is produced in Kansas and Mexico and consumed in New York and California. Kansas produces 15 shnupells of duckwheat and Mexico 8. Meanwhile,...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
(b) Graph the feasible region, give the coordinates of every vertex, and circle the vertex maxi- mizing profit. What is the maximum profit possible? 7.6. Give an example of a linear program in two variables whose feasible region is infinite, but such that there is an optimum solution of bounded cost. 7.7. Find necessary a...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
7.12. For the linear program max x1 −2x3 x1 −x2 ≤1 2x2 −x3 ≤1 x1, x2, x3 ≥0 prove that the solution (x1, x2, x3) = (3/2, 1/2, 0) is optimal. 7.13. Matching pennies. In this simple two-player game, the players (call them R and C) each choose an outcome, heads or tails. If both outcomes are equal, C gives a dollar to R; ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
ingredient energy protein fat carbohydrate sodium (kcal) (grams) (grams) (grams) (milligrams) tomato 21 0.85 0.33 4.64 9.00 lettuce 16 1.62 0.20 2.37 8.00 spinach 371 12.78 1.58 74.69 7.00 carrot 346 8.39 1.39 80.70 508.20 oil 884 0.00 100.00 0.00 0.00 Find a linear programming applet on the Web and use it to make the ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
• f (i) is a valid flow from si to ti. • For each edge e, the total flow f (1) e + f (2) e + · · · + f (k) e does not exceed the capacity ce. • The size of each flow f (i) is at least the demand di. • The size of the total flow (the sum of the flows) is as large as possible. How would you solve this problem? 7.21. An edge o...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
S B T A 1 3 2 1 1 (a) Write the problem of finding the maximum flow from S to T as a linear program. (b) Write down the dual of this linear program. There should be a dual variable for each edge of the network and for each vertex other than S, T. Now we’ll solve the same problem in full generality. Recall the linear prog...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
7.28. A linear program for shortest path. Suppose we want to compute the shortest path from node s to node t in a directed graph with edge lengths le > 0. (a) Show that this is equivalent to finding an s −t flow f that minimizes P e lefe subject to size(f) = 1. There are no capacity constraints. (b) Write the shortest pa...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
(b) Show that the fattest s −t path in a graph can be computed by a variant of Dijkstra’s algorithm. (c) Show that the maximum flow in G is the sum of individual flows along at most |E| paths from s to t. (d) Now show that if we always increase flow along the fattest path in the residual graph, then the Ford-Fulkerson alg...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Chapter 8 NP-complete problems 8.1 Search problems Over the past seven chapters we have developed algorithms for finding shortest paths and minimum spanning trees in graphs, matchings in bipartite graphs, maximum increasing sub- sequences, maximum flows in networks, and so on. All these algorithms are efficient, because i...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
The story of Sissa and Moore According to the legend, the game of chess was invented by the Brahmin Sissa to amuse and teach his king. Asked by the grateful monarch what he wanted in return, the wise man requested that the king place one grain of rice in the first square of the chessboard, two in the second, four in the...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Satisfiability SATISFIABILITY, or SAT (recall Exercise 3.28 and Section 5.3), is a problem of great practical importance, with applications ranging from chip testing and computer design to image analy- sis and software engineering. It is also a canonical hard problem. Here’s what an instance of SAT looks like: (x ∨y ∨z)...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 8.1 The optimal traveling salesman tour, shown in bold, has length 18. 4 5 6 3 3 3 2 4 1 2 3 components of a particular graph constructed from the instance (recall Exercise 3.28). In fact, in Chapter 9, we’ll see a different polynomial algorithm for this same special case, which is called 2SAT. On the other hand...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
cost as the budget. Fine, but how do we find the optimum cost? Easy: By binary search! (See Exercise 8.1.) Incidentally, there is a subtlety here: Why do we have to introduce a budget? Isn’t any optimization problem also a search problem in the sense that we are searching for a solution that has the property of being op...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
This graph has multiple edges between two vertices—a feature we have not been allowing so far in this book, but one that is meaningful for this particular problem, since each bridge must be accounted for separately. We are looking for a path that goes through each edge exactly once (the path is allowed to repeat vertic...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 8.3 What is the smallest cut in this graph? reminiscent of the TSP, and indeed no polynomial algorithm is known for it. There are two differences between the definitions of the Euler and Rudrata problems. The first is that Euler’s problem visits all edges while Rudrata’s visits all vertices. But there is also the ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
further cut would then be needed to separate the sky from the grass. Integer linear programming Even though the simplex algorithm is not polynomial time, we mentioned in Chapter 7 that there is a different, polynomial algorithm for linear programming. Therefore, linear pro- gramming is efficiently solvable both in pract...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 8.4 A more elaborate matchmaking scenario. Each triple is shown as a triangular- shaped node joining boy, girl, and pet. Armadillo Bobcat Carol Beatrice Alice Chet Bob Al Canary Independent set, vertex cover, and clique In the INDEPENDENT SET problem (recall Section 6.7) we are given a graph and an integer g, an...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
special case in which E consists of the edges of a graph, and there is a subset Si for each vertex, containing the edges adjacent to that vertex. Can you see why 3D MATCHING is also a special case of SET COVER? And finally there is the CLIQUE problem: given a graph and a goal g, find a set of g ver- tices such that all p...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
8.2 NP-complete problems Hard problems, easy problems In short, the world is full of search problems, some of which can be solved efficiently, while others seem to be very hard. This is depicted in the following table. Hard problems (NP-complete) Easy problems (in P) 3SAT 2SAT, HORN SAT TRAVELING SALESMAN PROBLEM MINIMU...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Why P and NP? Okay, P must stand for “polynomial.” But why use the initials NP (the common chatroom abbreviation for “no problem”) to describe the class of search problems, some of which are terribly hard? NP stands for “nondeterministic polynomial time,” a term going back to the roots of complexity theory. Intuitively...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
I. These two translation procedures f and h imply that any algorithm for B can be converted into an algorithm for A by bracketing it between f and h. I Instance Instance f(I) f Algorithm for A for B Algorithm Solution S of f(I) No solution to f(I) No solution to I h(S) of I Solution h And now we can finally define the cl...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 8.6 The space NP of all search problems, assuming P ̸= NP. NP− Increasing difficulty P complete Factoring One last point: we started off this book by introducing another famously hard search problem: FACTORING, the task of finding all prime factors of a given integer. But the difficulty of FACTORING is of a differ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 8.7 Reductions between search problems. 3D MATCHING RUDRATA CYCLE SUBSET SUM TSP ILP ZOE All of NP SAT 3SAT VERTEX COVER INDEPENDENT SET CLIQUE 8.3 The reductions We shall now see that the search problems of Section 8.1 can be reduced to one another as depicted in Figure 8.7. As a consequence, they are all NP-co...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Instance: nodes s, t G = (V, E) {s, x}, {x, t} G′ = (V ′, E′) RUDRATA CYCLE and edges {s, x}, {x, t} No solution Solution: path Add node x Solution: cycle No solution Delete edges RUDRATA (s, t)-PATH To confirm the validity of this reduction, we have to show that it works in the case of either outcome depicted. 1. When ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 8.8 The graph corresponding to (x ∨y ∨z) (x ∨y ∨z) (x ∨y ∨z) (x ∨y). y y y x z x z x z x y to pick only one of them for the independent set. Repeat this construction for all clauses—a clause with two literals will be represented simply by an edge joining the literals. (A clause with one literal is silly and can ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
It is usually cleaner to prove the contrapositive, that if I has a satisfying assignment then G has an independent set of size g. This is easy: for each clause, pick any literal whose value under the satisfying assignment is true (there must be at least one such literal), and add the corresponding vertex to S. Do you s...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 8.9 S is a vertex cover if and only if V −S is an independent set. S It is easy to see that in the new formula no variable appears more than three times (and in fact, no literal appears more than twice). Furthermore, the extra clauses involv- ing x1, x2, . . . , xk constrain these variables to have the same valu...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
p1 p3 g0 g1 b1 b0 p0 p2 Suppose that the two boys b0 and b1 and the two girls g0 and g1 are not involved in any other triples. (The four pets p0, . . . , p3 will of course belong to other triples as well; for otherwise the instance would trivially have no solution.) Then any matching must contain either the two triples...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
2n −m pets will be left unmatched (you can check that this number is sure to be positive, because we have at most three occurrences of every variable, and at least two literals in every clause). But this is easy to fix: Add 2n −m new boy-girl couples that are “generic animal- lovers,” and match them by triples with all ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
ZOE−→SUBSET SUM This is a reduction between two special cases of ILP: one with many equations but only 0 − 1 coefficients, and the other with a single equation but arbitrary integer coefficients. The reduction is based on a simple and time-honored idea: 0 −1 vectors can encode numbers! For example, given this instance of...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 8.10 Rudrata cycle with paired edges: C = {(e1, e3), (e5, e6), (e4, e5), (e3, e7), (e3, e8)}. e7 e1 e5 e4 e8 e3 e2 e6 ZOE−→RUDRATA CYCLE In the RUDRATA CYCLE problem we seek a cycle in a graph that visits every vertex exactly once. We shall prove it NP-complete in two stages: first we will reduce ZOE to a general...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 8.11 Reducing ZOE to RUDRATA CYCLE WITH PAIRED EDGES. variables equations xi = 0 (on the right side of the figure). This completes the construction. Take any solution of this instance of RUDRATA CYCLE WITH PAIRED EDGES. As discussed before, it picks a value for each variable and a variable for every equation. We ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
rest of the graph as shown in Figure 8.12(b). By symmetry, if the Rudrata cycle enters this subgraph at c, it must traverse it as in Figure 8.12(c). And these are the only two ways. But this property tells us something important: this gadget behaves just like two edges {a, b} and {c, d} that are paired up in the RUDRAT...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 8.12 A gadget for enforcing paired behavior. (a) a c f m s b d q p j h g l k n r (b) a c b d (c) a c b d (d) a c b d C = {({a, b}, {c, d})} 258
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
RUDRATA CYCLE−→TSP Given a graph G = (V, E), construct the following instance of the TSP: the set of cities is the same as V , and the distance between cities u and v is 1 if {u, v} is an edge of G and 1 + α otherwise, for some α > 1 to be determined. The budget of the TSP instance is equal to the number of nodes, |V |...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 8.13 An instance of CIRCUIT SAT. true AND NOT AND OR OR ? ? output ? AND returned the assignment (false, true, true) because, if we substitute these values to the unknown inputs (from left to right), the output becomes true. CIRCUIT SAT is a generalization of SAT. To see why, notice that SAT asks for a satisfyin...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Now that we know CIRCUIT SAT reduces to SAT, we turn to our main job, showing that all search problems reduce to CIRCUIT SAT. So, suppose that A is a problem in NP. We must discover a reduction from A to CIRCUIT SAT. This sounds very difficult, because we know almost nothing about A! All we know about A is that it is a ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Unsolvable problems At least an NP-complete problem can be solved by some algorithm—the trouble is that this algorithm will be exponential. But it turns out there are perfectly decent computational problems for which no algorithms exist at all! One famous problem of this sort is an arithmetical version of SAT. Given a ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Exercises 8.1. Optimization versus search. Recall the traveling salesman problem: TSP Input: A matrix of distances; a budget b Output: A tour which passes through all the cities and has length ≤b, if such a tour exists. The optimization version of this problem asks directly for the shortest tour. TSP-OPT Input: A matri...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
(a) Show that if each literal appears at most once, then the problem is solvable in polynomial time. (b) Show that INDEPENDENT SET remains NP-complete even in the special case when all the nodes in the graph have degree at most 4. 8.7. Consider a special case of 3SAT in which all clauses have exactly three literals, an...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Input: An undirected graph G = (V, E) Output: A spanning tree of G in which each node has degree ≤k, if such a tree exists. Show that for any k ≥2: (a) k-SPANNING TREE is a search problem. (b) k-SPANNING TREE is NP-complete. (Hint: Start with k = 2 and consider the relation between this problem and RUDRATA PATH.) 8.13....
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
EXPERIMENTAL CUISINE Input: n, the number of ingredients to choose from; D, the n×n “discord” matrix; some number p ≥0 Output: The maximum number of ingredients we can choose with penalty ≤p. Show that if EXPERIMENTAL CUISINE is solvable in polynomial time, then so is 3SAT. 8.17. Show that for any problem Π in NP, ther...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
• (wi, w′ i) for all i = 1, 2, . . ., n. • (w′ i, wj) and (w′ j, wi) for every (vi, vj) ∈E. (b) Show that if G contains a vertex cover of size b, then G′ contains a feedback arc set of size b. (c) Show that if G′ contains a feedback arc set of size b, then G contains a vertex cover of size (at most) b. (Hint: given a f...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
268
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Chapter 9 Coping with NP-completeness You are the junior member of a seasoned project team. Your current task is to write code for solving a simple-looking problem involving graphs and numbers. What are you supposed to do? If you are very lucky, your problem will be among the half-dozen problems concerning graphs with ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Unfortunately, this approach does not always work. For example, we know that 3SAT is NP-complete. And the INDEPENDENT SET problem, along with many other NP-complete problems, remains so even for planar graphs (graphs that can be drawn in the plane without crossing edges). Moreover, often you cannot neatly characterize ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
branching. We can expand either of the two available nodes, and on any variable of our choice. Let’s try this one: Initial formula φ w = 1 w = 0 x = 0 x = 1 This time, we are in luck. The partial assignment w = 0, x = 1 violates the clause (w ∨x) and can be terminated, thereby pruning a good chunk of the search space. ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 9.1 Backtracking reveals that φ is not satisfiable. (), (y ∨z) (y ∨z), (y), (y ∨z) (z), (z) (x ∨y), (y ∨z), (z), (z) (x ∨y), (y), () (x ∨y), () (w ∨x ∨y ∨z), (w ∨x), (x ∨y), (y ∨z), (z ∨w), (w ∨z) (x ∨y ∨z), (x), (x ∨y), (y ∨z) x = 1 () z = 0 z = 1 () () y = 1 z = 1 z = 0 y = 0 w = 1 w = 0 x = 0 In the case of SA...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
follow the same pattern. As before, we will deal with partial solutions, each of which represents a subproblem, namely, what is the (cost of the) best way to complete this solution? And as before, we need a basis for eliminating partial solutions, since there is no other source of efficiency in our method. To reject a s...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 9.2 (a) A graph and its optimal traveling salesman tour. (b) The branch-and-bound search tree, explored left to right. Boxed numbers indicate lower bounds on cost. (a) A B C D E F G H 1 2 1 1 1 2 1 2 5 1 1 1 A B C D E F G H 1 1 1 1 1 1 1 1 (b) A E H F G B F G D 15 14 8 B D C D H G H 8 E C G inf 8 10 13 12 8 8 14...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
9.2 Approximation algorithms In an optimization problem we are given an instance I and are asked to find the optimum solution—the one with the maximum gain if we have a maximization problem like INDEPEN- DENT SET, or the minimum cost if we are dealing with a minimization problem such as the TSP. For every instance I, le...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 9.3 A graph whose optimal vertex cover, shown shaded, is of size 8. Figure 9.4 (a) A matching, (b) its completion to a maximal matching, and (c) the resulting vertex cover. (a) (b) (c) What is the relationship between matchings and vertex covers? Here is the crucial fact: any vertex cover of a graph G must be at...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
2. It can be used to build a vertex cover, whose size can be related to that of the optimal cover using property 1. Thus, this simple algorithm has an approximation ratio of αA ≤2. In fact, it is not hard to find examples on which it does make a 100% error; hence αA = 2. 9.2.2 Clustering We turn next to a clustering pro...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 9.5 Some data points and the optimal k = 4 clusters. Figure 9.6 (a) Four centers chosen by farthest-first traversal. (b) The resulting clusters. (a) 2 1 4 3 (b) It’s clear that this algorithm returns a valid partition. What’s more, the resulting diameter is guaranteed to be at most twice optimal. Here’s the argum...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
9.2.3 TSP The triangle inequality played a crucial role in making the k-CLUSTER problem approximable. It also helps with the TRAVELING SALESMAN PROBLEM: if the distances between cities satisfy the metric properties, then there is an algorithm that outputs a tour of length at most 1.5 times optimal. We’ll now look at a ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
By the triangle inequality, these bypasses can only make the overall tour shorter. General TSP But what if we are interested in instances of TSP that do not satisfy the triangle inequality? It turns out that this is a much harder problem to approximate. Here is why: Recall that on page 259 we gave a polynomial-time red...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Let’s consider the O(nV ) algorithm. In the bad case when V is large, what if we simply scale down all the values in some way? For instance, if v1 = 117,586,003, v2 = 738,493,291, v3 = 238,827,453, we could simply knock off some precision and instead use 117, 738, and 238. This doesn’t change the problem all that much ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
• Finally, there is another class of problems, between the first two given here, for which the approximation ratio is about log n. SET COVER is an example. (A humbling reminder: All this is contingent upon the assumption P ̸= NP. Failing this, this hierarchy collapses down to P, and all NP-complete optimization problems...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
iterations will be needed: whether for instance, there might be an exponential number of them. Likewise, all we can easily say about the final tour is that it is locally optimal—that is, it is superior to the tours in its immediate neighborhood. There might be better solutions further away. For instance, the following p...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 9.7 (a) Nine American cities. (b) Local search, starting at a random tour, and using 3-change. The traveling salesman tour is found after three moves. (a) Tulsa Albuquerque Amarillo Wichita Little Rock Dallas Houston San Antonio El Paso (b) (i) (ii) (iii) (iv) 284
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 9.8 Local search. Figure 9.7 shows a specific example of local search at work. Figure 9.8 is a more abstract, stylized depiction of local search. The solutions crowd the unshaded area, and cost decreases when we move downward. Starting from an initial solution, the algorithm moves downhill until a local optimum i...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 9.9 An instance of GRAPH PARTITIONING, with the optimal partition for α = 1/2. Vertices on one side of the cut are shaded. would give the MINIMUM CUT problem, which we know to be efficiently solvable using flow techniques. The present variant, however, is NP-hard. In designing a local search algorithm, it will be ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
What can be done about such suboptimal solutions? We could expand the neighborhood size to allow two swaps at a time, but this particular bad instance would still stubbornly resist. Instead, let’s look at some other generic schemes for improving local search procedures. 9.3.3 Dealing with local optima Randomization and...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
repeat randomly choose a solution s′ in the neighborhood of s if ∆= cost(s′) −cost(s) is negative: replace s by s′ else: replace s by s′ with probability e−∆/T . If T is zero, this is identical to our previous local search. But if T is large, then moves that increase the cost are occasionally accepted. What value of T ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 9.10 The search space for a graph with eight nodes. The space contains 35 solutions, which have been partitioned into seven groups for clarity. An example of each is shown. There are five local optima. 4 states, cost 2 1 state, cost 0 8 states, cost 3 8 states, cost 4 4 states, cost 6 2 states, cost 4 8 states, c...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 9.11 Simulated annealing. The trick is to start with T large and then gradually reduce it to zero. Thus initially, the local search can wander around quite freely, with only a mild preference for low-cost solutions. As time goes on, this preference becomes stronger, and the system mostly sticks to the lower-cost...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Exercises 9.1. In the backtracking algorithm for SAT, suppose that we always choose a subproblem (CNF formula) that has a clause that is as small as possible; and we expand it along a variable that appears in this small clause. Show that this is a polynomial-time algorithm in the special case in which the input formula...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
9.6. In the MINIMUM STEINER TREE problem, the input consists of: a complete graph G = (V, E) with distances duv between all pairs of nodes; and a distinguished set of terminal nodes V ′ ⊆V . The goal is to find a minimum-cost tree that includes the vertices V ′. This tree may or may not include nodes in V −V ′. Suppose ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
start with any S ⊆V while there is a subset S′ ⊆V such that ||S′| −|S|| = 1 and w(S′) > w(S) do: set S = S′ (a) Show that this is an approximation algorithm for MAX CUT with ratio 2. (b) But is it a polynomial-time algorithm? 9.10. Let us call a local search algorithm exact when it always produces the optimum solution....
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
294
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Chapter 10 Quantum algorithms This book started with the world’s oldest and most widely used algorithms (the ones for adding and multiplying numbers) and an ancient hard problem (FACTORING). In this last chapter the tables are turned: we present one of the latest algorithms—and it is an efficient algorithm for FACTORING...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 10.1 An electron can be in a ground state or in an excited state. In the Dirac notation used in quantum physics, these are denoted 0 and 1 . But the superposition principle says that, in fact, the electron is in a state that is a linear combination of these two: α0 0 + α1 1 . This would make imme...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 10.2 Measurement of a superposition has the effect of forcing the system to decide on a particular state, with probabilities determined by the amplitudes. with prob |α0|2 with prob |α1|2 α0 0 + α1 1 state 0 state 1 second excited state, and so on. So we could consider a k-level system consisting ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Entanglement Suppose we have two qubits, the first in the state α0 0 + α1 1 and the second in the state β0 0 + β1 1 . What is the joint state of the two qubits? The answer is, the (tensor) product of the two: α0β0 00 + α0β1 01 + α1β0 10 + α1β1 11 . Given an arbitrary state of two qubits, ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 10.3 A quantum algorithm takes n “classical” bits as its input, manipulates them so as to create a superposition of their 2n possible states, manipulates this exponentially large superposition to obtain the final quantum result, and then measures the result to get (with the appropriate probability distribution) t...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
the hidden pattern. All this probably sounds quite mysterious at the moment, but more details are on the way. In Section 10.3 we will give a high-level description of the most important operation that can be efficiently performed by a quantum computer: a quantum version of the fast Fourier transform (FFT). We will then ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Figure 10.4 The classical FFT circuit from Chapter 2. Input vectors of M bits are processed in a sequence of m = log M levels.               ! "# $% &' () *+ ,- ./ α0 α4 α2 α6 α1 α5 α7 α3 1 4 4 4 4 6 6 7 4 4 2 2 6 3 2 5 4 β0 β1 β2 β3 β4 β5 β6 β7 point: the j notation is really jus...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Input: A superposition of m = log M qubits, α = PM−1 j=0 αj j . Method: Using O(m2) = O(log2 M) quantum operations perform the quantum FFT to obtain the superposition β = PM−1 j=0 βj j . Output: A random m-bit number j (that is, 0 ≤j ≤M −1), from the probability distribution Pr[j] = |βj|2. Quantum Fouri...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
The Fourier transform of a periodic vector Suppose the vector α = (α0, α1, . . . , αM−1) is periodic with period k and with no offset (that is, the nonzero terms are α0, αk, α2k, . . .). Thus, α = M/k−1 X j=0 q k M jk . We will show that its Fourier transform β = (β0, β1, . . . , βM−1) is also periodic,...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Let’s make this more precise. Lemma Suppose s independent samples are drawn uniformly from 0, M k , 2M k , . . . , (k −1)M k . Then with probability at least 1 −k/2s, the greatest common divisor of these samples is M/k. Proof. The only way this can fail is if all the samples are multiples of j · M/k, where j is some in...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
Yet another basic gate, the controlled phase gate, is described below in the subsection describing the quantum circuit for the QFT. Now let us consider the following question: Suppose we have a quantum state on n qubits, α = P x∈{0,1}n αx x . How many of these 2n amplitudes change if we apply the Hadamard gate ...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf
Dasgupta-Papadimitriou-Vazirani.pdf
true
318
α0 α2 α3 j + M/2 j α1 βj+M/2 FFTM/2 FFTM/2 ... ... βj FFTM (input: α0, . . . , αM−1, output: β0, . . . , βM−1) αM−2 αM−1 Let’s see how to simulate this on a quantum system. The input is now encoded in the 2m amplitudes of m = log M qubits. Thus the decomposition of the inputs into evens and odds, as shown in the preced...