Determine the size of an instance of the minimum spanning tree problem.

Similar documents
CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

Travelling Salesman Problem

NP-Complete problems

Graph Theory and Optimization Computational Complexity (in brief)

Theory of Computation Chapter 9

Computational Complexity

3.7 Cutting plane methods

VIII. NP-completeness

NP and Computational Intractability

2.13 Maximum flow with a strictly positive initial feasible flow

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

Automata Theory CS Complexity Theory I: Polynomial Time

CSCI 1590 Intro to Computational Complexity

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 22 Lecturer: David Wagner April 24, Notes 22 for CS 170

Combinatorial Optimization

Limitations of Algorithm Power

CSI 4105 MIDTERM SOLUTION

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

NP-Complete Problems. Complexity Class P. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar..

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

Show that the following problems are NP-complete

Polynomial-Time Reductions

3.4 Relaxations and bounds

NP Completeness and Approximation Algorithms

CS21 Decidability and Tractability

CSCI3390-Second Test with Solutions

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

Notes for Lecture 21

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Lecture 4: NP and computational intractability

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Theory of Computation Time Complexity

Geometric Steiner Trees

Discrete Optimization 2010 Lecture 8 Lagrangian Relaxation / P, N P and co-n P

Lecture 18: More NP-Complete Problems

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

Data Structures in Java

Algorithms Design & Analysis. Approximation Algorithm

Lecture 18: P & NP. Revised, May 1, CLRS, pp

15.083J/6.859J Integer Optimization. Lecture 2: Efficient Algorithms and Computational Complexity

NP Complete Problems. COMP 215 Lecture 20

NP-completeness. Chapter 34. Sergey Bereg

NP-Completeness. Until now we have been designing algorithms for specific problems

NP-COMPLETE PROBLEMS. 1. Characterizing NP. Proof

NP-problems continued

3.10 Lagrangian relaxation

Unit 1A: Computational Complexity

Chapter 3: Discrete Optimization Integer Programming

IE418 Integer Programming

Introduction to Complexity Theory

Formal definition of P

Algorithms: COMP3121/3821/9101/9801

More on NP and Reductions

NP-Completeness. Algorithmique Fall semester 2011/12

CS/COE

Computability and Complexity Theory: An Introduction

NP-problems continued

NP-Completeness. NP-Completeness 1

NP-Completeness Review

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

NP-Hardness reductions

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P

NP-Complete Problems. More reductions

Technische Universität München, Zentrum Mathematik Lehrstuhl für Angewandte Geometrie und Diskrete Mathematik. Combinatorial Optimization (MA 4502)

ECS122A Handout on NP-Completeness March 12, 2018

Chapter 3: Discrete Optimization Integer Programming

9.5. Polynomial and Rational Inequalities. Objectives. Solve quadratic inequalities. Solve polynomial inequalities of degree 3 or greater.

The Complexity of Optimization Problems

Data Structures and Algorithms

3.3 Easy ILP problems and totally unimodular matrices

Introduction. Pvs.NPExample

1. Introduction Recap

CS 301: Complexity of Algorithms (Term I 2008) Alex Tiskin Harald Räcke. Hamiltonian Cycle. 8.5 Sequencing Problems. Directed Hamiltonian Cycle

P, NP, NP-Complete, and NPhard

NP-Complete Reductions 2

The knapsack Problem

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

Graduate Algorithms CS F-21 NP & Approximation Algorithms

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.

Algorithm Design and Analysis

A An Overview of Complexity Theory for the Algorithm Designer

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas

Complexity and NP-completeness

NP-Complete Problems and Approximation Algorithms

1.1 P, NP, and NP-complete

Computational Complexity. IE 496 Lecture 6. Dr. Ted Ralphs

Lecture #14: NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition.

More NP-Complete Problems

CS 6505, Complexity and Algorithms Week 7: NP Completeness

8.5 Sequencing Problems

Comp487/587 - Boolean Formulas

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions

Correctness of Dijkstra s algorithm

Admin NP-COMPLETE PROBLEMS. Run-time analysis. Tractable vs. intractable problems 5/2/13. What is a tractable problem?

Lecture 5: Computational Complexity

NP and Computational Intractability

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University

Transcription:

3.1 Algorithm complexity Consider two alternative algorithms A and B for solving a given problem. Suppose A is O(n 2 ) and B is O(2 n ), where n is the size of the instance. Let n A 0 be the size of the largest instance that can be solved in one hour with algorithm A on a given computer, and n B 0 be the corresponding size for algorithm B. Denote by n A e n B the size of the largest instances that can be solved in one hour on a computer that is 100 times faster. How large is n A with respect to n A 0 and nb with respect to n B 0? 3.2 Size of a problem instance Determine the size of an instance of the minimum spanning tree problem. 3.3 N P-hardness of Integer Linear Programming Show that Integer Linear Programming (ILP) is NP-hard, by showing that the associated recognition problem ILP-r is N P-complete. ILP: Given a matrix A Z m n and two vectors b Z m and c Z n, find x {0,1} n such that Ax b which minimizes c T x. ILP-r: Given a matrix A Z m n and a vector b Z m, is there a vector x {0,1} n such that Ax b? [Hint: Consider the Boolean Satisfiability problem (SAT): Given n Boolean variables y 1,...,y n and m clauses C 1,...,C m (disjunctions over the Boolean variables y 1,...,y n and their complements y 1,...,y n ), does there exist a truth assignment of the Boolean variables which makes all the clauses true? Describe a polynomial-time reduction from SAT to ILP-r.] 3.4 Complexity of longest and shortest simple paths A simple path in a directed graph is a path that visits each intermediate node at most once. Consider the Max-SimplePath problem: Given a directed graph G = (N, A) with a rational length associated to each arc, and a pair of nodes s and t, find a simple path of maximum total length from s to t. Show that this problem is NP-hard. To do so, show that the following recognition version of Max-SimplePath is N P-complete. Max-SimplePath-r: Given a directed graph G = (N, A) with a rational length associated to each arc, a pair of nodes s,t, and an integer K, does there exist a simple path from s to t of length at least K? [Hint: Consider the Hamiltonian-Circuit-r problem where, given a directed graph, we have to decide whether it contains a Hamiltonian circuit. Describe a polynomial-time reduction from Hamiltonian-Circuit-r to Max-SimplePath-r.] Document prepared by L. Liberti, S. Bosio, S. Coniglio, and C. Iuliano. Translation to English by S. Coniglio 1

Now consider the Min-SimplePath problem: Given a directed graph with rational arc costs, and a pair of nodes s,t, we look for a shortest simple path from s to t. Why is it also NP-hard? 3.5 Problem complexity and size of the ILP formulations Give an Integer Linear Programming formulation for the problem of finding a minimum cost spanning tree in an undirected graph G = (V,E). How does the number of constraints grow with the number of the nodes n = V? Is there a direct relationship between the size of an ILP formulation (number of constraints and variables) and the difficulty of the corresponding problem? Document prepared by L. Liberti, S. Bosio, S. Coniglio, and C. Iuliano. Translation to English by S. Coniglio 2

Solution 3.1 Algorithm complexity Let n A and n B denote the size of the largest instances that can be solved in one hour with algorithms A and B on a computer 100 times faster that the original one. Since, by definition of n A 0, (na 0 )2 elementary operations are performed when using algorithm A on the original computer, 100(n A 0 )2 operations can be executed on the faster machine. Therefore, (n A ) 2 = 100(n A 0 )2 and hence n A = 10n A 0. Similarly, for algorithm B, we have that 2nB 0 operations are performed on the original computer, 100 2 nb 0 are performed on the faster one, and hence n B = n B 0 +log 2(100) < n B 0 +7. To summarize, with the quadratic algorithm A we can solve instances that are 10 times larger, while with the exponential algorithm B we can solve instances that are larger by a small number of bits. 3.2 Size of a problem instance An instance of the minimum spanning tree problem consists of a graph G = (V,E), with a weight c ij assigned to each edge {i,j} E. Recall that, given an integer i Z, logi + 1 bits are needed to code it in memory. The +1 addendum takes into account the sign bit. For nonnegative integers, log i bits suffice. For each edge {i,j} E we need to memorize the indices of the two nodes i amd j, using 2 logn bits per node, and the weight c ij, using logc max +1 bits, where max := max ij E c ij. In total, we need logn + logm +m(2 logn + logc max +1) bits, that is, O(m(logn+logc max )). Note that we can suppose that m > n, otherwise the graph is not connected and it admits no spanning tree. Usually, the number of bits needed to code a numerical value is taken as a constant. For instance, for a 64 bit machine, we can suppose that we will never deal with instances with more than 2 64 arcs or nodes. Similarly, we can suppose that c max 2 64, so that c max can be stored in a single memory word. Under this assumption, the size of an instance is O(m). For dense graphs, where m n 2 the instance has a quadratic size, since O(m) = O(n 2 ) whereas for sparse graphs, where m < n 2, the size is less than quadratic but still more than linear since m > n. Document prepared by L. Liberti, S. Bosio, S. Coniglio, and C. Iuliano. Translation to English by S. Coniglio 3

3.3 N P-hardness of Integer Linear Programming Consider the recognition problem ILP-r ILP-r: Given a matrix A Z m n and a vector b Z m, does there exist a vector x {0,1} n such that Ax b? Note that the recognition version of ILP where we are also given a linear objective function with cost vector c and an integer K, and we look for a binary vector x such that Ax b and c T x K is not harder than ILP-r since the constraint c T x K can be added to Ax b. To show that ILP-r is NP-complete, we need to (i) verify that ILP-r is in NP, and (ii) show that a known NP-complete problem can be reduced in polynomial time to ILP-r. The polynomial-time reduction is from the Boolean Satisfiability (SAT) problem. SAT: Given n Boolean variables y 1,...,y n and m Boolean clauses C 1,...,C m (disjunctions over the Boolean variables y 1,...,y n and their complements y 1,...,y n ), is there a truth assignment (an assignment of value true or false ) of the Boolean variables which makes all the clauses true? (ii) ILP-r is in NP since (a) it is a recognition problem and (b) given a binary vector x {0,1} n, we can verify in polynomial time that it satisfies all the inequalities of the system Ax b. Given any SAT instance with n Boolean variables y 1,...,y n and m clauses C 1,...,C m, it is easy to construct a particular instance of ILP-r with n binary variables x 1,...,x n and m linear inequalities such that the instance of SAT has answer yes if and only if the corresponding instance of ILP-r has answer yer. For each clause C j, with 1 j m, we construct a linear inequality as follows. If the k-th variable in clause C j is y i, the k-th term of the j-th constraint is x i. If the k-th variable is ȳ i, the k-th term is (1 x i ). Moreover, the disjunction operator in C j is replaced with the addition operator. For example, given the SAT instance we construct the ILP-r instance C 1 = (y 1 y 2 y 3 ) C 2 = (ȳ 1 ȳ 2 ) C 3 = (y 2 ȳ 3 ), x 1 +x 2 +x 3 1 (1 x 1 )+(1 x 2 ) 1 x 2 +(1 x 3 ) 1 x 1,x 2,x 3 {0,1}. Clearly, there is a one-to-one correspondence between the truth assignments of the Boolean variables y 1,...,y n which make all the clauses (C 1, C 2 and C 3 ) true and the binary vectors x which satify all the linear inequalities of the corresponding ILP-r instance. Indeed, y i = true if and only if x i = 1. Document prepared by L. Liberti, S. Bosio, S. Coniglio, and C. Iuliano. Translation to English by S. Coniglio 4

3.4 Complexity of longest and shortest simple paths To prove that Max-SimplePath-r is N P-complete, we need to (i) verify that the problem belongs to NP and (ii) show that any other problem in NP can be reduced to our problem in polynomial time. Max-SimplePath-r is clearly in NP. Indeed, (a) it is a recognition problem and (b) given any solution to it (sequence of nodes), we can verify in polynomial time (linear time w.r.t. to the number of nodes in G) that it is a path from s to t, it is simple, and it has a total cost > K. To verify (ii), we show that the problem Hamiltonian-Circuit-r, which is known to be N P-complete, can be reduced in polynomial time to Max-SimplePath-r. Hamiltonian-Circuit-r: Given a directed graph G = (N,A ), does it contain a Hamiltonian circuit, i.e., a circuit visiting each node of G exactly once? Given any instance of Hamiltonian-Circuit-r, it is easy to construct in polynomial time a particular instance of Max-SimplePath-r such that the answer to the Hamiltonian-Circuitr instance is yes if and only if the answer to the corresponding Max-SimplePath-r instance is yes. Let G = (N,A ) be the directed graph of the given instance of Hamiltonian-Circuit-r. Consider the particular instance of Max-SimplePath-r defined by the directed graph G = (N,A) where N = N, A = A, and each arc has a unit length. Moreover, we take s = t as any node in N and K = N. Clearly, G contains a Hamiltonian circuit if and only if G contains a simple path from s to t of length at least N. Indeed, any Hamiltonian circuit is a simple path from a node to itself with exactly N arcs. Note that the polynomial-time reduction is very simple here because the graph in the Hamiltonian-Circuit-r can be directly used in the Max-SimplePath-r instance and we just need to appropriately select the nodes s, t and the value of K. Let Max-SimplePath be the problem of, given a directed graph and a pair of nodes s and t, finding a longest simple path from s to t. Since Max-SimplePath-r is NP-complete, Max- SimplePath is N P-hard. Indeed, Max-SimplePath is at least as hard as Max-SimplePath-r (an algorithm for the former problem could be used to solve the latter one) and is not in NP (it isn t a recognition problem). To verify that the problem Min-SimplePath is also NP-hard, we just need to reduce in polynomial time Max-SimplePath-r to its recognition version Min-SimplePath-r. Given any instance of Max-SimplePath-r defined by G = (V,A), weights c ij, nodes s,t and value K, it suffices to consider the instance of Min-SimplePath-r with G = (V,A ), c ij, K where V = V, A = A, c ij = c ij for all arcs (i,j) A and K = K. 3.5 Problem complexity and size of the ILP formulations Consider any instance of the minimum spanning tree problem, which consists of a graph G = (V,E) with a cost c ij assigned to each edge {i,j} E. For each edge {i,j}, we define a binary variable x ij such that x ij = 1 if the edge is in the spanning tree and x ij = 0 otherwise. Then the problem can be formulated as the following Document prepared by L. Liberti, S. Bosio, S. Coniglio, and C. Iuliano. Translation to English by S. Coniglio 5

Integer Linear Program: min s.t. {i,j} E c ijx ij {i,j} E x ij = V 1 (cardinality) {i,j} E:i,j S x ij S 1 S V : 2 S < V (subtour elimination) x ij {0,1} i,j V. There is a subtour elimination constraint for each proper subset S of V, of cardinality at least 2. For S = V, the corresponding subtour elimination constraint amounts to the cardinality constraint. Note that, since there are 2 n n 2 subtour elimination constraints, the size of the above ILP formulation grows exponentially with the number of nodes n = V of G. Therefore, even if a polynomial-time algorithm for solving these ILPs would exist, it would require exponential time with respect to the size of the graph G. This example shows that the size of an ILP formulation of a discrete optimization problem is not directly related to its inherent computational complexity. What really matters is the problem structure. Indeed, Prim s and Kruskal s simple algorithms exploit the (matroidal) structure of the minimum spanning tree problem to find an optimal solution in polynomial time. Document prepared by L. Liberti, S. Bosio, S. Coniglio, and C. Iuliano. Translation to English by S. Coniglio 6