Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discrete Optimization Lecture 4 – Part 1 M. Pawan Kumar

Similar presentations


Presentation on theme: "Discrete Optimization Lecture 4 – Part 1 M. Pawan Kumar"— Presentation transcript:

1 Discrete Optimization Lecture 4 – Part 1 M. Pawan Kumar pawan.kumar@ecp.fr

2 Open Book –Textbooks –Research Papers –Course Slides –No Electronic Devices Easy Questions – 10 points Not-So-Easy Questions – 5 points Hard Questions – 5 points What to Expect in the Final Exam

3 Grading on a Curve Absolute scores are converted to relative scores.

4 Easy Question – Shortest Path v1v1 v1v1 v0v0 v0v0 v2v2 v2v2 v3v3 v3v3 v4v4 v4v4 3 2 -2 12 3 6 3 2 Find the shortest path from v 0 to all other vertices. Show the estimate of the distance at each iteration.

5 Not-So-Easy Question – Shortest Path Suppose there exists an algorithm that can find the shortest path from any vertex to any other vertex of a general graph. Show how such an algorithm can be used to determine whether a given graph is Hamiltonian or not.

6 Easy Question – MST Apply Kruskal’s Algorithm. Show which edge is added at each iteration. v1v1 v1v1 v0v0 v0v0 v2v2 v2v2 v6v6 v6v6 v4v4 v4v4 v5v5 v5v5 v3v3 v3v3 2 1 2 -5 1 1 -2 -4

7 Not-So-Easy Question – MST Prove that there always exists a minimum spanning tree that includes the edge with the minimum length.

8 Easy Question – Minimum Cut Apply Dinits’s Algorithm. Show the residual graph, the s-t path and the value of the flow at each iteration. v1v1 v2v2 3 s t 24 12

9 Not-So-Easy Question – Minimum Cut Consider the problem of finding the minimum cut in a general graph. By adding a large constant to the capacity of each arc, we obtain a modified graph on which we can compute the maximum flow. Prove or disprove that this algorithm is correct.

10 Outline Preliminaries –Random Access Machine (RAM) –Polynomial-time Algorithm –Decision Problems P, NP, and NP-Complete Problems

11 Given an array f with elements = 0,1 strings RAM executes a set of instructions Each instruction can –Read entries from prescribed positions –Perform arithmetic operation on read entries –Write answers to prescribed positions Random Access Machine

12 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Instructions numbered 0, 1, …, t Variable z 0 stores the instruction to execute Random Access Machine

13 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Instructions numbered 0, 1, …, t Stop if z 0 > t Random Access Machine

14 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Read instruction –z i := f(z j ) Random Access Machine

15 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Write instruction –f(z i ) := z j Random Access Machine

16 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Add instruction –z i := z j + z k Random Access Machine

17 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Subtract instruction –z i := z j - z k Random Access Machine

18 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Multiply instruction –z i := z j z k Random Access Machine

19 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Divide instruction –z i := z j / z k Random Access Machine

20 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Increment instruction –z i := z i + 1 Random Access Machine

21 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Binarize instruction –z i := 1, if z i > 0 –z i := 0, otherwise Random Access Machine

22 z 2 := f(z 1 ) z 1 := z 1 +1 z 3 := f(z 1 ) z 4 := z 2 + z 3 z 1 := z 1 +1 f(z 1 ) := z 4 1030 Array f z 1 = 0 z 2 = 0 z 3 = 0 z 4 = 0

23 Random Access Machine z 2 := f(z 1 ) z 1 := z 1 +1 z 3 := f(z 1 ) z 4 := z 2 + z 3 z 1 := z 1 +1 f(z 1 ) := z 4 1030 Array f z 1 = 0 z 2 = 10 z 3 = 0 z 4 = 0

24 Random Access Machine z 2 := f(z 1 ) z 1 := z 1 +1 z 3 := f(z 1 ) z 4 := z 2 + z 3 z 1 := z 1 +1 f(z 1 ) := z 4 1030 Array f z 1 = 0 z 2 = 10 z 3 = 0 z 4 = 0

25 Random Access Machine z 2 := f(z 1 ) z 1 := z 1 +1 z 3 := f(z 1 ) z 4 := z 2 + z 3 z 1 := z 1 +1 f(z 1 ) := z 4 1030 Array f z 1 = 1 z 2 = 10 z 3 = 0 z 4 = 0

26 Random Access Machine z 2 := f(z 1 ) z 1 := z 1 +1 z 3 := f(z 1 ) z 4 := z 2 + z 3 z 1 := z 1 +1 f(z 1 ) := z 4 1030 Array f z 1 = 1 z 2 = 10 z 3 = 0 z 4 = 0

27 Random Access Machine z 2 := f(z 1 ) z 1 := z 1 +1 z 3 := f(z 1 ) z 4 := z 2 + z 3 z 1 := z 1 +1 f(z 1 ) := z 4 1030 Array f z 1 = 1 z 2 = 10 z 3 = 3 z 4 = 0

28 Random Access Machine z 2 := f(z 1 ) z 1 := z 1 +1 z 3 := f(z 1 ) z 4 := z 2 + z 3 z 1 := z 1 +1 f(z 1 ) := z 4 1030 Array f z 1 = 1 z 2 = 10 z 3 = 3 z 4 = 0

29 Random Access Machine z 2 := f(z 1 ) z 1 := z 1 +1 z 3 := f(z 1 ) z 4 := z 2 + z 3 z 1 := z 1 +1 f(z 1 ) := z 4 1030 Array f z 1 = 1 z 2 = 10 z 3 = 3 z 4 = 13

30 Random Access Machine z 2 := f(z 1 ) z 1 := z 1 +1 z 3 := f(z 1 ) z 4 := z 2 + z 3 z 1 := z 1 +1 f(z 1 ) := z 4 1030 Array f z 1 = 1 z 2 = 10 z 3 = 3 z 4 = 13

31 Random Access Machine z 2 := f(z 1 ) z 1 := z 1 +1 z 3 := f(z 1 ) z 4 := z 2 + z 3 z 1 := z 1 +1 f(z 1 ) := z 4 1030 Array f z 1 = 2 z 2 = 10 z 3 = 3 z 4 = 13

32 Random Access Machine z 2 := f(z 1 ) z 1 := z 1 +1 z 3 := f(z 1 ) z 4 := z 2 + z 3 z 1 := z 1 +1 f(z 1 ) := z 4 1030 Array f z 1 = 2 z 2 = 10 z 3 = 3 z 4 = 13

33 Random Access Machine z 2 := f(z 1 ) z 1 := z 1 +1 z 3 := f(z 1 ) z 4 := z 2 + z 3 z 1 := z 1 +1 f(z 1 ) := z 4 10313 Array f z 1 = 2 z 2 = 10 z 3 = 3 z 4 = 13

34 Outline Preliminaries –Random Access Machine (RAM) –Polynomial-time Algorithm –Decision Problems P, NP, and NP-Complete Problems

35 Input size = Number of bits b Polynomial time algorithm –Number of instructions = t –t is bounded by a polynomial in b –Good algorithm –Efficient algorithm Polynomial Time Algorithm

36 Preliminaries –Random Access Machine (RAM) –Polynomial-time Algorithm –Decision Problems (Answered by ‘yes’ or ‘no’) P, NP, and NP-Complete Problems Reduction Outline

37 Finite set Σ called alphabet of size ≥ 2 –{0,1} –{a,b,c,d,e,…,x,y,z} Set Σ* of all finite length strings (called words) –0, 1, 00, 01, 10, 11, 000,…. –discrete, optimization Size of word size(w) = number of letters –size(00) = 2 –size(discrete) = 8 Decision Problem

38 Problem Π is a subset of Σ* –All words with the answer “yes” Informal problem –Given input word x  Σ*, does x  Π ? Polynomial-time solvable problem Π –There exists a polynomial-time algorithm for the informal problem –Polynomial in size(x) Decision Problem

39 Shortest Path v 0,v 1,v 2 … v n  Σ {  Σ 0,1,2, … N  Σ }  Σ,  Σ {v 0,v 1,v 2,v 3,v 4,v 5 }, {{v 0,v 1 },{v 0,v 3 },{v 1,v 2 },{v 2,v 3 },{v 2,v 4 },{v 3,v 4 }}, {3,5,5,4,6,1}, v1v1 v1v1 v0v0 v0v0 v2v2 v2v2 v3v3 v3v3 v4v4 v4v4 3 5 4 51 6 {v 0,v 3,v 4,v 2 }  Σ*

40 Shortest Path v 0,v 1,v 2 … v n  Σ {  Σ 0,1,2, … N  Σ }  Σ,  Σ {v 0,v 1,v 2,v 3,v 4,v 5 }, {{v 0,v 1 },{v 0,v 3 },{v 1,v 2 },{v 2,v 3 },{v 2,v 4 },{v 3,v 4 }}, {3,5,5,4,6,1}, v1v1 v1v1 v0v0 v0v0 v2v2 v2v2 v3v3 v3v3 v4v4 v4v4 3 5 4 51 6 {v 0,v 3,v 2 }  Σ*

41 Shortest Path v 0,v 1,v 2 … v n  Σ {  Σ 0,1,2, … N  Σ }  Σ,  Σ {v 0,v 1,v 2,v 3,v 4,v 5 }, {{v 0,v 1 },{v 0,v 3 },{v 1,v 2 },{v 2,v 3 },{v 2,v 4 },{v 3,v 4 }}, {3,5,5,4,6,1}, v1v1 v1v1 v0v0 v0v0 v2v2 v2v2 v3v3 v3v3 v4v4 v4v4 3 5 4 51 6 {v 0,v 1,v 2 }  Σ*

42 Shortest Path v 0,v 1,v 2 … v n  Σ {  Σ 0,1,2, … N  Σ }  Σ,  Σ {v 0,v 1,v 2,v 3,v 4,v 5 }, {{v 0,v 1 },{v 0,v 3 },{v 1,v 2 },{v 2,v 3 },{v 2,v 4 },{v 3,v 4 }}, {3,5,5,4,6,1}, v1v1 v1v1 v0v0 v0v0 v2v2 v2v2 v3v3 v3v3 v4v4 v4v4 3 5 4 51 6 {v 0,v 1,v 2 }  Π

43 Shortest Path v 0,v 1,v 2 … v n  Σ {  Σ 0,1,2, … N  Σ }  Σ,  Σ {v 0,v 1,v 2,v 3,v 4,v 5 }, {{v 0,v 1 },{v 0,v 3 },{v 1,v 2 },{v 2,v 3 },{v 2,v 4 },{v 3,v 4 }}, {3,5,5,4,6,1}, v1v1 v1v1 v0v0 v0v0 v2v2 v2v2 v3v3 v3v3 v4v4 v4v4 3 5 4 51 6 {v 0,v 3,v 4 }  Π Given graph G and path P, is P a shortest path in G?

44 Hamiltonian Circuit v1v1 v1v1 v0v0 v0v0 v2v2 v2v2 v3v3 v3v3 v4v4 v4v4 3 5 4 51 6 5 Circuit consisting of all vertices

45 Hamiltonian Graph v1v1 v1v1 v0v0 v0v0 v2v2 v2v2 v3v3 v3v3 v4v4 v4v4 3 5 4 51 6 5 Has a Hamiltonian Circuit ✔

46 Hamiltonian Graph v1v1 v1v1 v0v0 v0v0 v2v2 v2v2 v3v3 v3v3 v4v4 v4v4 3 5 4 51 6 5 Has a Hamiltonian Circuit ✖ Given graph G, is the graph Hamiltonian?

47 Hamiltonian Graph v 0,v 1,v 2 … v n  Σ {  Σ 0,1,2, … N  Σ }  Σ,  Σ v1v1 v1v1 v0v0 v0v0 v2v2 v2v2 v3v3 v3v3 v4v4 v4v4 3 5 4 51 5 {v 0,v 1,v 2,v 3,v 4,v 5 }, {{v 0,v 3 },{v 1,v 3 },{v 2,v 1 },{v 3,v 0 },{v 3,v 4 },{v 4,v 2 }},  Σ*

48 Hamiltonian Graph v 0,v 1,v 2 … v n  Σ {  Σ 0,1,2, … N  Σ }  Σ,  Σ {v 0,v 1,v 2,v 3,v 4,v 5 }, {{v 0,v 3 },{v 1,v 0 },{v 2,v 1 },{v 3,v 0 },{v 3,v 4 },{v 4,v 2 }},  Σ* v1v1 v1v1 v0v0 v0v0 v2v2 v2v2 v3v3 v3v3 v4v4 v4v4 3 5 4 51 6 5

49 Hamiltonian Graph v 0,v 1,v 2 … v n  Σ {  Σ 0,1,2, … N  Σ }  Σ,  Σ {v 0,v 1,v 2,v 3,v 4,v 5 }, {{v 0,v 3 },{v 1,v 0 },{v 2,v 1 },{v 3,v 0 },{v 3,v 4 },{v 4,v 2 }},  Π v1v1 v1v1 v0v0 v0v0 v2v2 v2v2 v3v3 v3v3 v4v4 v4v4 3 5 4 51 6 5

50 Preliminaries P, NP, and NP-Complete Problems Outline

51 P Polynomial-time solvable problem Π –There exists a polynomial-time algorithm that decides whether x  Σ* belongs to Π or not. –Polynomial in size(x) P = {all Π, Π is polynomial time solvable} For example –Shortest path with +ve lengths  P –Shortest path with no –ve length circuit  P

52 NP Π  NP –There exists a problem Π’  P –There exists a polynomial p –There exists an x, size(x) ≤ p(size(w)) such that –w  Π if and only if wx  Π’ Polynomial-time checkable ‘certificate’ For example –Hamiltonian graph problem  NP

53 NP Relationship between P and NP? P is a subset of NP –“P = NP or not” is an open problem –One of Clay Institute’s Millennium Prize problems For example –Shortest path with +ve lengths  NP –Shortest path with no –ve length circuit  NP

54 NP-Complete Hardest problems in NP –All problems in NP can be reduced to an NP- complete problem Π is reducible to Λ –There exists a polynomial time algorithm –Given w, returns x –w  Π if and only if x  Λ If Λ  P then Π  P

55 NP-Complete Hardest problems in NP –All problems in NP can be reduced to an NP- complete problem Π is reducible to Λ –There exists a polynomial time algorithm –Given w, returns x –w  Π if and only if x  Λ If Λ  NP then Π  NP

56 NP-Complete Hardest problems in NP –All problems in NP can be reduced to an NP- complete problem Π is reducible to Λ –There exists a polynomial time algorithm –Given w, returns x –w  Π if and only if x  Λ If Λ  NP-complete and Λ  P, then P = NP


Download ppt "Discrete Optimization Lecture 4 – Part 1 M. Pawan Kumar"

Similar presentations


Ads by Google