Who Has Heard of This Problem? Courtesy: Jeremy Kun

Size: px
Start display at page:

Download "Who Has Heard of This Problem? Courtesy: Jeremy Kun"

Transcription

1 P vs. NP

2 Who Has Heard of This Problem? Courtesy: Jeremy Kun

3 Runtime Analysis Last time, we saw that there is no solution to the Halting Problem. Halting Problem: Determine if a program will halt. Input: A program p and its input x. Output: Yes or No depending on whether p running on x ever halts.

4 Runtime Analysis Last time, we saw that there is no solution to the Halting Problem. Halting Problem: Determine if a program will halt. Input: A program p and its input x. Output: Yes or No depending on whether p running on x ever halts. Compromise: Can we count the number of steps that a proposed algorithm will take?

5 Runtime Analysis Think: How many steps does this algorithm take to run? func FrequentWords(Text string, k int) []string { freqpatterns := make([]string, 0) freq := FrequencyMap(Text, k) m := Max(freq) for pattern, val := range freq { if val == m { freqpatterns = append(freqpatterns, pattern) } } return freqpatterns }

6 Runtime Analysis Inverse Game of Life Problem: Reverse the Game of Life problem. Input: An n x n Game of Life board. Output: A previous board (if one exists).

7 Runtime Analysis Inverse Game of Life Problem: Reverse the Game of Life problem. Input: An n x n Game of Life board. Output: A previous board (if one exists).??? Think: What algorithm might you propose for this problem? And how long would it take?

8 Runtime Analysis Inverse Game of Life Problem: Reverse the Game of Life problem. Input: An n x n Game of Life board. Output: A previous board (if one exists).??? The problem is that there are 2 n different possible GoL configurations, so we can t just try them all

9 Polynomial vs. Exponential Runtime Exercise 1: Say that a computer takes n 2 steps to complete a task on an input size of length n. How many more steps does it take to complete this task on an input size of length n+1? Exercise 2: Say that a computer takes 2 n steps to complete a task on an input size of length n. How many more steps does it take to complete this task on an input size of length n+1?

10 Polynomial vs. Exponential Runtime Exercise 1: Say that a computer takes n 2 steps to complete a task on an input size of length n. How many more steps does it take to complete this task on an input size of length n+1? Answer: (n+1) 2 n 2 = 2n+1 Exercise 2: Say that a computer takes 2 n steps to complete a task on an input size of length n. How many more steps does it take to complete this task on an input size of length n+1?

11 Polynomial vs. Exponential Runtime Exercise 1: Say that a computer takes n 2 steps to complete a task on an input size of length n. How many more steps does it take to complete this task on an input size of length n+1? Answer: (n+1) 2 n 2 = 2n+1 Exercise 2: Say that a computer takes 2 n steps to complete a task on an input size of length n. How many more steps does it take to complete this task on an input size of length n+1? Answer: 2 n+1 2 n = 2 n (2 1) = 2 n

12 Definition of P P is the set of decision problems that are answerable in a polynomial number of steps by a computer.

13 Definition of P P is the set of decision problems that are answerable in a polynomial number of steps by a computer. In terms of Turing machines, if n is the number of symbols written on the tape when the machine is started (the input length) then the machine must halt in at most p(n) steps for some polynomial p.

14 Definition of P P is the set of decision problems that are answerable in a polynomial number of steps by a computer. In terms of Turing machines, if n is the number of symbols written on the tape when the machine is started (the input length) then the machine must halt in at most p(n) steps for some polynomial p. Think of P as tractable problems.

15 Definition of EXPTIME EXPTIME: set of decision problems that are solvable in at most an exponential number of steps.

16 Definition of EXPTIME EXPTIME: set of decision problems that are solvable in at most an exponential number of steps. Question: Are there decision problems in EXPTIME that we can prove do not belong to P? EXPTIME! P!

17 A Provably Exponential Problem Checkers Problem: Input: an integer n and a placement of checkers on an n x n checkerboard. Output: Yes if White can guarantee a win from this placement; No otherwise. EXPTIME! P!

18 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise.

19 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. Think: Do you see a solution? Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise.

20 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise. 1

21 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise. 1 2

22 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

23 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

24 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

25 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

26 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

27 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

28 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

29 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

30 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

31 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. 12 Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

32 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

33 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

34 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. 14 Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

35 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. 14 Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

36 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. 14 Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

37 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. 14 Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

38 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. 14 Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

39 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. 14 Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

40 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. 14 Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

41 Hamiltonian Cycle Problem Hamiltonian Cycle: a walk through a network that touches each node exactly once and returns to its starting node. 14 Think: What algorithm did you use? Hamiltonian Cycle Problem Input: a network with n nodes. Output: Yes if there is a Hamiltonian cycle in the network; No otherwise

42 Enumerating Number of Hamiltonian Paths Idea: Identify every possible walk through the graph of length n, and test each one

43 Enumerating Number of Hamiltonian Paths Idea: Identify every possible walk through the graph of length n, and test each one. 14 Think 1: How many such walks are there?

44 Enumerating Number of Hamiltonian Paths Idea: Identify every possible walk through the graph of length n, and test each one. 14 Think 1: How many such walks are there? Think 2: But how did you solve this problem?

45 Difference Between the Two Problems Given a walk in the graph, we can easily test whether it is a Hamiltonian cycle

46 Difference Between the Two Problems Given a walk in the graph, we can easily test whether it is a Hamiltonian cycle. But how could we verify a candidate solution to the Checkers Problem?

47 Definition of NP NP: the set of decision problems for which candidate solutions are verifiable in a polynomial number of steps.

48 Definition of NP NP: the set of decision problems for which candidate solutions are verifiable in a polynomial number of steps. Think 1: If a problem is in P, does it automatically belong in NP?

49 Definition of NP NP: the set of decision problems for which candidate solutions are verifiable in a polynomial number of steps. Think 1: If a problem is in P, does it automatically belong in NP? Answer: Of course!

50 Definition of NP NP: the set of decision problems for which candidate solutions are verifiable in a polynomial number of steps. Think 1: If a problem is in P, does it automatically belong in NP? Answer: Of course! Think 2: If a problem is in NP, does it automatically belong in P?

51 Definition of NP NP: the set of decision problems for which candidate solutions are verifiable in a polynomial number of steps. Think 1: If a problem is in P, does it automatically belong in NP? Answer: Of course! Think 2: If a problem is in NP, does it automatically belong in P? Answer: Nobody knows!

52 Who Here Has Heard of This Problem? Courtesy: Jeremy Kun

53 In other words... Are there any decision problems in the blue area below? NP! P!

54 HCP is an Example Key Point: No one has ever found a polynomial-time algorithm solving the Hamiltonian Cycle Problem!

55 Finding a Fast Algorithm to HCP is Hard I can't find an efficient algorithm, I guess I'm just too dumb. From Garey and Johnson. Computers and Intractability. 1979

56 Ideally, We Could Prove that P!= NP I can't find an efficient algorithm, because no such algorithm exists! From Garey and Johnson. Computers and Intractability. 1979

57 Present State of Affairs: In Limbo I can't find an efficient algorithm, but neither can all these geniuses. From Garey and Johnson. Computers and Intractability. 1979

58 Millennium Problems P = NP? is one of seven Millennium Problems in mathematics: The Clay Institute will award you $1 million if you can solve it.

59 Millennium Problems P = NP? is one of seven Millennium Problems in mathematics: The Clay Institute will award you $1 million if you can solve it. In 2003, Grigory Perelman solved one of the problems (the Poincare conjecture) but turned down the prize.

60 The Traveling Salesman Problem Traveling Salesman Problem (TSP): Does a cheap tour visiting n cities exist? Input: A collection of n cities with costs of traveling between each pair and a maximum cost c. Output: Yes if there is a cyclic tour visiting all the cities with cost at most c, and No otherwise. Think: Is TSP in P? Is it in NP?

61 The Traveling Salesman Problem Traveling Salesman Problem (TSP): Does a cheap tour visiting n cities exist? Input: A collection of n cities with costs of traveling between each pair and a maximum cost c. Output: Yes if there is a cyclic tour visiting all the cities with cost at most c, and No otherwise. Think: Is TSP in P? Is it in NP? Answer: It is certainly in NP, but no fast algorithm is known!

62 TSP in USA (Best Known Answer) Courtesy David Applegate, Robert Bixby, Vasek Chvatal and William Cook

63 Reducing HCP into TSP 1. Given graph G, assign a weight 0 to every edge. 2. For every edge not in the graph, assign it cost The resulting graph G has a tour of cost <=0 if and only if G has a Hamiltonian cycle.

64 Reducing HCP into TSP 1. Given graph G, assign a weight 0 to every edge. 2. For every edge not in the graph, assign it cost The resulting graph G has a tour of cost <=0 if and only if G has a Hamiltonian cycle. G!

65 Reducing HCP into TSP 1. Given graph G, assign a weight 0 to every edge. 2. For every edge not in the graph, assign it cost The resulting graph G has a tour of cost <=0 if and only if G has a Hamiltonian cycle. G! G! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0!

66 Reducing HCP into TSP 1. Given graph G, assign a weight 0 to every edge. 2. For every edge not in the graph, assign it cost The resulting graph G has a tour of cost <=0 if and only if G has a Hamiltonian cycle. In other words, if TSP were easy, then HCP would be easy too; just transform any instance of HCP into TSP.

67 Reducing HCP into TSP 1. Given graph G, assign a weight 0 to every edge. 2. For every edge not in the graph, assign it cost The resulting graph G has a tour of cost <=0 if and only if G has a Hamiltonian cycle. In other words, if TSP were easy, then HCP would be easy too; just transform any instance of HCP into TSP. We can also show that TSP reduces to HCP (more difficult), meaning that TSP and HCP are essentially equivalent.

68 NP-Complete Problems The most difficult problems in NP (including TSP and HCP) are called NP-Complete.

69 NP-Complete Problems The most difficult problems in NP (including TSP and HCP) are called NP-Complete. There are thousands of NP-Complete problems, and they are all equivalent to each other.

70 NP-Complete Problems The most difficult problems in NP (including TSP and HCP) are called NP-Complete. There are thousands of NP-Complete problems, and they are all equivalent to each other. Think: What should we do if we determine that a given problem is NP-Complete?

71 Updated Picture (If P!= NP) Another question: Are there any decision problems in the blue area (in NP but not NP-Complete and not yet proven to be in P)? NP-Complete! P! NP!

72 Integer Factorization Integer Factorization Problem: Determine the factors of a given number. Input: An integer x (containing n bits in binary) and an integer k. Output: Yes if x has a factor < k, and No otherwise.

73 Integer Factorization Integer Factorization Problem: Determine the factors of a given number. Input: An integer x (containing n bits in binary) and an integer k. Output: Yes if x has a factor < k, and No otherwise. Think: Where does it belong? NP-Complete! NP! P!

74 Integer Factorization Integer Factorization Problem: Determine the factors of a given number. Input: An integer x (containing n bits in binary) and an integer k. Output: Yes if x has a factor < k, and No otherwise. Think: Where does it belong? NP-Complete! Answer: Nobody knows! P! NP!

75 Graph Isomorphism Problem Graph Isomorphism Problem: Determine if two networks are the same. Input: Two networks, each containing n nodes. Output: Yes if the networks are isomorphic and No otherwise.

76 Graph Isomorphism Problem Graph Isomorphism Problem: Determine if two networks are the same. Input: Two networks, each containing n nodes. Output: Yes if the networks are isomorphic and No otherwise. =! Courtesy: Wikimedia Commons user Booyabazooka!

77 Graph Isomorphism Problem Graph Isomorphism Problem: Determine if two networks are the same. Input: Two networks, each containing n nodes. Output: Yes if the networks are isomorphic and No otherwise. Nov (!!!): There is a quasi-polynomial algorithm solving this problem with runtime ~2 k*(log n)^c (Laszlo Babai)

78 Graph Isomorphism Problem

79 Addressing NP-Completeness Heuristic: An algorithm that provides quick candidate solutions for a problem that are not guaranteed to be correct (but that often present a reasonable approximation). Example: UPGMA...

80 Restating TSP as Optimization Problem Traveling Salesman Problem (TSP OPT ): Find a cheapest tour of n cities. Input: A collection of n cities with costs of traveling between each pair. Output: A minimum-cost tour that visits all of the cities.

81 Restating TSP as Optimization Problem Traveling Salesman Problem (TSP OPT ): Find a cheapest tour of n cities. Input: A collection of n cities with costs of traveling between each pair. Output: A minimum-cost tour that visits all of the cities. Optimization Problem: Finding a solution that maximizes or minimizes a function relative to constraints.

82 Restating TSP as Optimization Problem Traveling Salesman Problem (TSP OPT ): Find a cheapest tour of n cities. Input: A collection of n cities with costs of traveling between each pair. Output: A minimum-cost tour that visits all of the cities. Optimization Problem: Finding a solution that maximizes or minimizes a function relative to constraints. Think: Any ideas on how to design a heuristic for TSP OPT?

83 Similar Tours Wichita! T 1! St. Louis! Jefferson City! Kansas City! Tours T 1 and T 2 are neighbors if we can switch two edges to change from T 1 to T 2.

84 Similar Tours Wichita! T 2! St. Louis! Jefferson City! Kansas City! Tours T 1 and T 2 are neighbors if we can switch two edges to change from T 1 to T 2.

85 Idea for TSP Heuristic 1. Start with an arbitrary initial tour visiting all cities.

86 Idea for TSP Heuristic 1. Start with an arbitrary initial tour visiting all cities. 2. Consider all possible neighbors of this tour. If one is found with lower score, update the current tour to this tour.

87 Idea for TSP Heuristic 1. Start with an arbitrary initial tour visiting all cities. 2. Consider all possible neighbors of this tour. If one is found with lower score, update the current tour to this tour. 3. Repeat until we reach a tour for which no neighbors can improve the score.

88 Neighbor Interchange Pseudocode NeighborInterchange(Graph) tour ß arbitrary cycle through all cities of Graph score ß Score(tour) bestscore ß Score(tour) besttour ß tour while bestscore < score score ß bestscore for each neighbor tour of tour if Score(tour ) < bestscore tour ß tour bestscore ß Score(tour ) return tour

89 Neighbor Interchange Pseudocode NeighborInterchange(Graph) tour ß arbitrary cycle through all cities of Graph score ß Score(tour) bestscore ß Score(tour) besttour ß tour while bestscore < score score ß bestscore for each neighbor tour of tour if Score(tour ) < bestscore tour ß tour bestscore ß Score(tour ) return tour Think: Can you see any weaknesses with this heuristic?

90 A Different Evolutionary Tree Problem Chimp Human Seal Whale ACGTAGGCCT ATGTAAGACT TCGAGAGCAC TCGAAAGCAT n species! m characters!

91 A Different Evolutionary Tree Problem Chimp Human Seal Whale ACGTAGGCCT ATGTAAGACT TCGAGAGCAC TCGAAAGCAT?????????????????????????????? ACGTAGGCCT ATGTAAGACT TCGAGAGCAC TCGAAAGCAT Chimp! Human! Seal! Whale!

92 A Different Evolutionary Tree Problem ACGAAAGCCT ACGTAAGCCT TCGAAAGCAT ACGTAGGCCT ATGTAAGACT TCGAGAGCAC TCGAAAGCAT Chimp! Human! Seal! Whale!

93 A Different Evolutionary Tree Problem Parsimony score: sum of Hamming distances along each edge. 1 ACGAAAGCCT 2 ACGTAAGCCT TCGAAAGCAT ACGTAGGCCT ATGTAAGACT TCGAGAGCAC TCGAAAGCAT Chimp! Human! Seal! Whale!

94 A Different Evolutionary Tree Problem Parsimony score: sum of Hamming distances along each edge. Parsimony Score: 8! 1 ACGAAAGCCT 2 ACGTAAGCCT TCGAAAGCAT ACGTAGGCCT ATGTAAGACT TCGAGAGCAC TCGAAAGCAT Chimp! Human! Seal! Whale!

95 Small Parsimony Small Parsimony Problem: Find the most parsimonious labeling of the internal nodes of a rooted tree. Input: A rooted binary tree with each leaf labeled by a string of length m. Output: A labeling of all other nodes of the tree by strings of length m that minimizes the tree s parsimony score.

96 Small Parsimony Small Parsimony Problem: Find the most parsimonious labeling of the internal nodes of a rooted tree. Input: A rooted binary tree with each leaf labeled by a string of length m. Output: A labeling of all other nodes of the tree by strings of length m that minimizes the tree s parsimony score. Optimization Problem: Finding a solution that maximizes or minimizes a function relative to constraints.

97 Small Parsimony Small Parsimony Problem: Find the most parsimonious labeling of the internal nodes of a rooted tree. Input: A rooted binary tree with each leaf labeled by a string of length m. Output: A labeling of all other nodes of the tree by strings of length m that minimizes the tree s parsimony score. This problem has a polynomial-time algorithm!

98 Large Parsimony Large Parsimony Problem: Given a set of strings, find a tree (with leaves labeled by all these strings) having minimum parsimony score. Input: A collection of strings of equal length. Output: A rooted binary tree T that minimizes the parsimony score among all possible rooted binary trees with leaves labeled by these strings. But if we aren t given the tree, (the decision version of this problem) becomes NP-Complete.

99 A Heuristic for Large Parsimony Note that removing an internal edge (along with its nodes), produces four subtrees (W, X, Y, Z). W w y Y a b X x z Z

100 A Heuristic for Large Parsimony Note that removing an internal edge (along with its nodes), produces four subtrees (W, X, Y, Z). W w y Y a b X x z Z

101 A Heuristic for Large Parsimony Note that removing an internal edge (along with its nodes), produces four subtrees (W, X, Y, Z). W w y Y X x z Z

102 A Heuristic for Large Parsimony Swapping trees like this is called a nearest neighbor interchange. W w y Y W w x X a b a b X x z Z Y y z Z W w y Y a b Z z x X

103 A Heuristic for Large Parsimony Nearest Neighbor Interchange Heuristic: 1. Set current tree equal to arbitrary binary rooted tree structure.

104 A Heuristic for Large Parsimony Nearest Neighbor Interchange Heuristic: 1. Set current tree equal to arbitrary binary rooted tree structure. 2. Go through all internal edges and perform all possible nearest neighbor interchanges.

105 A Heuristic for Large Parsimony Nearest Neighbor Interchange Heuristic: 1. Set current tree equal to arbitrary binary rooted tree structure. 2. Go through all internal edges and perform all possible nearest neighbor interchanges. 3. Solve Small Parsimony Problem on each tree.

106 A Heuristic for Large Parsimony Nearest Neighbor Interchange Heuristic: 1. Set current tree equal to arbitrary binary rooted tree structure. 2. Go through all internal edges and perform all possible nearest neighbor interchanges. 3. Solve Small Parsimony Problem on each tree. 4. If any tree has parsimony score improving over optimal tree, set it equal to the current tree. Otherwise, return current tree.

107 A Heuristic for Large Parsimony Nearest Neighbor Interchange Heuristic: 1. Set current tree equal to arbitrary binary rooted tree structure. 2. Go through all internal edges and perform all possible nearest neighbor interchanges. 3. Solve Small Parsimony Problem on each tree. 4. If any tree has parsimony score improving over optimal tree, set it equal to the current tree. Otherwise, return current tree. Think: Does this remind you of anything?

108 Local Search Neighbor interchange for TSP and Large Parsimony is an example of a local search algorithm, which explores nearby solutions and looks for improvements. Problem: May get stuck in a local optimum! Courtesy: David Beamish

109 Improving Local Search Think: How could we improve local search approaches? Courtesy: David Beamish

110 Improving Local Search Idea 1: Run algorithm on many different initial values. Courtesy: David Beamish

111 Improving Local Search Idea 1: Run algorithm on many different initial values. Idea 2: Provide some jiggle to allow candidate solutions to bounce out of local optima. Courtesy: David Beamish

112 Monte Carlo Algorithm: Randomized algorithm that is not guaranteed to produce a correct result. Courtesy: Sam Garza

113 Metropolis Algorithm The metropolis algorithm is a local search technique that is inspired by physical systems.

114 Metropolis Algorithm The metropolis algorithm is a local search technique that is inspired by physical systems. Simulated annealing: allow for very hot initial conditions that allow a lot of jiggle, and cool down over time.

115 Metropolis Algorithm The metropolis algorithm is a local search technique that is inspired by physical systems. Gibbs-Boltzmann function: The probability of a system being in a state of energy E is e -E/(kT) Where T > 0 is the temperature of the system and k is some constant to make the probabilities work out.

116 Metropolis Algorithm The metropolis algorithm is a local search technique that is inspired by physical systems. Gibbs-Boltzmann function: The probability of a system being in a state of energy E is e -E/(kT) Where T > 0 is the temperature of the system and k is some constant to make the probabilities work out. The larger the T, the larger the probability.

117 HW9 Protein structure prediction: Given the order of amino acids making up a protein, predict its final shape. Courtesy: khbio.info

118 HW9 Protein structure prediction: Given the order of amino acids making up a protein, predict its final shape. Even the simplest ways of formulating this problem are NP-complete. Courtesy: khbio.info

119 HW9 Protein structure prediction: Given the order of amino acids making up a protein, predict its final shape. Even the simplest ways of formulating this problem are NP-complete. Great candidate for simulated annealing. Courtesy: khbio.info

CSE 135: Introduction to Theory of Computation NP-completeness

CSE 135: Introduction to Theory of Computation NP-completeness CSE 135: Introduction to Theory of Computation NP-completeness Sungjin Im University of California, Merced 04-15-2014 Significance of the question if P? NP Perhaps you have heard of (some of) the following

More information

Analysis of Algorithms. Unit 5 - Intractable Problems

Analysis of Algorithms. Unit 5 - Intractable Problems Analysis of Algorithms Unit 5 - Intractable Problems 1 Intractable Problems Tractable Problems vs. Intractable Problems Polynomial Problems NP Problems NP Complete and NP Hard Problems 2 In this unit we

More information

Hamiltonian Cycle. Hamiltonian Cycle

Hamiltonian Cycle. Hamiltonian Cycle Hamiltonian Cycle Hamiltonian Cycle Hamiltonian Cycle Problem Hamiltonian Cycle Given a directed graph G, is there a cycle that visits every vertex exactly once? Such a cycle is called a Hamiltonian cycle.

More information

P, NP, NP-Complete. Ruth Anderson

P, NP, NP-Complete. Ruth Anderson P, NP, NP-Complete Ruth Anderson A Few Problems: Euler Circuits Hamiltonian Circuits Intractability: P and NP NP-Complete What now? Today s Agenda 2 Try it! Which of these can you draw (trace all edges)

More information

Introduction to Complexity Theory

Introduction to Complexity Theory Introduction to Complexity Theory Read K & S Chapter 6. Most computational problems you will face your life are solvable (decidable). We have yet to address whether a problem is easy or hard. Complexity

More information

Tractable & Intractable Problems

Tractable & Intractable Problems Tractable & Intractable Problems We will be looking at : What is a P and NP problem NP-Completeness The question of whether P=NP The Traveling Salesman problem again Programming and Data Structures 1 Polynomial

More information

Artificial Intelligence. 3 Problem Complexity. Prof. Dr. Jana Koehler Fall 2016 HSLU - JK

Artificial Intelligence. 3 Problem Complexity. Prof. Dr. Jana Koehler Fall 2016 HSLU - JK Artificial Intelligence 3 Problem Complexity Prof. Dr. Jana Koehler Fall 2016 Agenda Computability and Turing Machines Tractable and Intractable Problems P vs. NP Decision Problems Optimization problems

More information

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

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms Computer Science 385 Analysis of Algorithms Siena College Spring 2011 Topic Notes: Limitations of Algorithms We conclude with a discussion of the limitations of the power of algorithms. That is, what kinds

More information

COMP Analysis of Algorithms & Data Structures

COMP Analysis of Algorithms & Data Structures COMP 3170 - Analysis of Algorithms & Data Structures Shahin Kamali Computational Complexity CLRS 34.1-34.4 University of Manitoba COMP 3170 - Analysis of Algorithms & Data Structures 1 / 50 Polynomial

More information

Limitations of Algorithm Power

Limitations of Algorithm Power Limitations of Algorithm Power Objectives We now move into the third and final major theme for this course. 1. Tools for analyzing algorithms. 2. Design strategies for designing algorithms. 3. Identifying

More information

Chapter 34: NP-Completeness

Chapter 34: NP-Completeness Graph Algorithms - Spring 2011 Set 17. Lecturer: Huilan Chang Reference: Cormen, Leiserson, Rivest, and Stein, Introduction to Algorithms, 2nd Edition, The MIT Press. Chapter 34: NP-Completeness 2. Polynomial-time

More information

1 Heuristics for the Traveling Salesman Problem

1 Heuristics for the Traveling Salesman Problem Praktikum Algorithmen-Entwurf (Teil 9) 09.12.2013 1 1 Heuristics for the Traveling Salesman Problem We consider the following problem. We want to visit all the nodes of a graph as fast as possible, visiting

More information

P and NP. Warm Up: Super Hard Problems. Overview. Problem Classification. Tools for classifying problems according to relative hardness.

P and NP. Warm Up: Super Hard Problems. Overview. Problem Classification. Tools for classifying problems according to relative hardness. Overview Problem classification Tractable Intractable P and NP Reductions Tools for classifying problems according to relative hardness Inge Li Gørtz Thank you to Kevin Wayne, Philip Bille and Paul Fischer

More information

Algorithms Design & Analysis. Approximation Algorithm

Algorithms Design & Analysis. Approximation Algorithm Algorithms Design & Analysis Approximation Algorithm Recap External memory model Merge sort Distribution sort 2 Today s Topics Hard problem Approximation algorithms Metric traveling salesman problem A

More information

VIII. NP-completeness

VIII. NP-completeness VIII. NP-completeness 1 / 15 NP-Completeness Overview 1. Introduction 2. P and NP 3. NP-complete (NPC): formal definition 4. How to prove a problem is NPC 5. How to solve a NPC problem: approximate algorithms

More information

P and NP. Inge Li Gørtz. Thank you to Kevin Wayne, Philip Bille and Paul Fischer for inspiration to slides

P and NP. Inge Li Gørtz. Thank you to Kevin Wayne, Philip Bille and Paul Fischer for inspiration to slides P and NP Inge Li Gørtz Thank you to Kevin Wayne, Philip Bille and Paul Fischer for inspiration to slides 1 Overview Problem classification Tractable Intractable Reductions Tools for classifying problems

More information

} } } Lecture 23: Computational Complexity. Lecture Overview. Definitions: EXP R. uncomputable/ undecidable P C EXP C R = = Examples

} } } Lecture 23: Computational Complexity. Lecture Overview. Definitions: EXP R. uncomputable/ undecidable P C EXP C R = = Examples Lecture 23 Computational Complexity 6.006 Fall 2011 Lecture 23: Computational Complexity Lecture Overview P, EXP, R Most problems are uncomputable NP Hardness & completeness Reductions Definitions: P =

More information

Problem Complexity Classes

Problem Complexity Classes Problem Complexity Classes P, NP, NP-Completeness and Complexity of Approximation Joshua Knowles School of Computer Science The University of Manchester COMP60342 - Week 2 2.15, March 20th 2015 In This

More information

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

NP-Completeness. Until now we have been designing algorithms for specific problems NP-Completeness 1 Introduction Until now we have been designing algorithms for specific problems We have seen running times O(log n), O(n), O(n log n), O(n 2 ), O(n 3 )... We have also discussed lower

More information

CSC 1700 Analysis of Algorithms: P and NP Problems

CSC 1700 Analysis of Algorithms: P and NP Problems CSC 1700 Analysis of Algorithms: P and NP Problems Professor Henry Carter Fall 2016 Recap Algorithmic power is broad but limited Lower bounds determine whether an algorithm can be improved by more than

More information

NP and NP Completeness

NP and NP Completeness CS 374: Algorithms & Models of Computation, Spring 2017 NP and NP Completeness Lecture 23 April 20, 2017 Chandra Chekuri (UIUC) CS374 1 Spring 2017 1 / 44 Part I NP Chandra Chekuri (UIUC) CS374 2 Spring

More information

Computational Complexity

Computational Complexity p. 1/24 Computational Complexity The most sharp distinction in the theory of computation is between computable and noncomputable functions; that is, between possible and impossible. From the example of

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Design and Analysis of Algorithms CSE 5311 Lecture 25 NP Completeness Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1 NP-Completeness Some

More information

Traveling Salesman Problem

Traveling Salesman Problem Traveling Salesman Problem Zdeněk Hanzálek hanzalek@fel.cvut.cz CTU in Prague April 17, 2017 Z. Hanzálek (CTU) Traveling Salesman Problem April 17, 2017 1 / 33 1 Content 2 Solved TSP instances in pictures

More information

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18 601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18 20.1 Introduction Definition 20.1.1 We say that an algorithm runs in polynomial time if its running

More information

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

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University NP-Completeness CptS 223 Advanced Data Structures Larry Holder School of Electrical Engineering and Computer Science Washington State University 1 Hard Graph Problems Hard means no known solutions with

More information

Computers and Intractability. The Bandersnatch problem. The Bandersnatch problem. The Bandersnatch problem. A Guide to the Theory of NP-Completeness

Computers and Intractability. The Bandersnatch problem. The Bandersnatch problem. The Bandersnatch problem. A Guide to the Theory of NP-Completeness Computers and Intractability A Guide to the Theory of NP-Completeness The Bible of complexity theory Background: Find a good method for determining whether or not any given set of specifications for a

More information

Computers and Intractability

Computers and Intractability Computers and Intractability A Guide to the Theory of NP-Completeness The Bible of complexity theory M. R. Garey and D. S. Johnson W. H. Freeman and Company, 1979 The Bandersnatch problem Background: Find

More information

Computational Complexity

Computational Complexity Computational Complexity Problems, instances and algorithms Running time vs. computational complexity General description of the theory of NP-completeness Problem samples 1 Computational Complexity What

More information

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

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1 CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY E. Amaldi Foundations of Operations Research Politecnico di Milano 1 Goal: Evaluate the computational requirements (this course s focus: time) to solve

More information

Computability and Complexity Theory

Computability and Complexity Theory Discrete Math for Bioinformatics WS 09/10:, by A Bockmayr/K Reinert, January 27, 2010, 18:39 9001 Computability and Complexity Theory Computability and complexity Computability theory What problems can

More information

Data Structures in Java

Data Structures in Java Data Structures in Java Lecture 21: Introduction to NP-Completeness 12/9/2015 Daniel Bauer Algorithms and Problem Solving Purpose of algorithms: find solutions to problems. Data Structures provide ways

More information

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

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9 1 Computational Complexity and Intractability: An Introduction to the Theory of NP Chapter 9 2 Objectives Classify problems as tractable or intractable Define decision problems Define the class P Define

More information

Lecture 4: NP and computational intractability

Lecture 4: NP and computational intractability Chapter 4 Lecture 4: NP and computational intractability Listen to: Find the longest path, Daniel Barret What do we do today: polynomial time reduction NP, co-np and NP complete problems some examples

More information

CS/COE

CS/COE CS/COE 1501 www.cs.pitt.edu/~nlf4/cs1501/ P vs NP But first, something completely different... Some computational problems are unsolvable No algorithm can be written that will always produce the correct

More information

P versus NP. Math 40210, Spring September 16, Math (Spring 2012) P versus NP September 16, / 9

P versus NP. Math 40210, Spring September 16, Math (Spring 2012) P versus NP September 16, / 9 P versus NP Math 40210, Spring 2012 September 16, 2012 Math 40210 (Spring 2012) P versus NP September 16, 2012 1 / 9 Properties of graphs A property of a graph is anything that can be described without

More information

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35. NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979. NP-Completeness 1 General Problems, Input Size and

More information

P,NP, NP-Hard and NP-Complete

P,NP, NP-Hard and NP-Complete P,NP, NP-Hard and NP-Complete We can categorize the problem space into two parts Solvable Problems Unsolvable problems 7/11/2011 1 Halting Problem Given a description of a program and a finite input, decide

More information

8.3 Hamiltonian Paths and Circuits

8.3 Hamiltonian Paths and Circuits 8.3 Hamiltonian Paths and Circuits 8.3 Hamiltonian Paths and Circuits A Hamiltonian path is a path that contains each vertex exactly once A Hamiltonian circuit is a Hamiltonian path that is also a circuit

More information

CMSC 441: Algorithms. NP Completeness

CMSC 441: Algorithms. NP Completeness CMSC 441: Algorithms NP Completeness Intractable & Tractable Problems Intractable problems: As they grow large, we are unable to solve them in reasonable time What constitutes reasonable time? Standard

More information

P versus NP. Math 40210, Fall November 10, Math (Fall 2015) P versus NP November 10, / 9

P versus NP. Math 40210, Fall November 10, Math (Fall 2015) P versus NP November 10, / 9 P versus NP Math 40210, Fall 2015 November 10, 2015 Math 40210 (Fall 2015) P versus NP November 10, 2015 1 / 9 Properties of graphs A property of a graph is anything that can be described without referring

More information

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

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P Easy Problems vs. Hard Problems CSE 421 Introduction to Algorithms Winter 2000 NP-Completeness (Chapter 11) Easy - problems whose worst case running time is bounded by some polynomial in the size of the

More information

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

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine. The Class NP NP is the problems that can be solved in polynomial time by a nondeterministic machine. NP The time taken by nondeterministic TM is the length of the longest branch. The collection of all

More information

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness Lecture 19 NP-Completeness I 19.1 Overview In the past few lectures we have looked at increasingly more expressive problems that we were able to solve using efficient algorithms. In this lecture we introduce

More information

M is a TM with start state s defined over the alphabet {#,(,),0,1,a,q,,}:

M is a TM with start state s defined over the alphabet {#,(,),0,1,a,q,,}: M is a TM with start state s defined over the alphabet {#,(,),0,1,a,q,,}: State Sym. Next State Head s # s L s ) t L t 0 h R t 1 t 1 1. What is M? Use the table given to number the states and head instructions.

More information

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

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015 CS 374: Algorithms & Models of Computation, Spring 2015 NP Completeness Lecture 23 November 19, 2015 Chandra & Lenny (UIUC) CS374 1 Spring 2015 1 / 37 Part I NP-Completeness Chandra & Lenny (UIUC) CS374

More information

NP-Complete Problems and Approximation Algorithms

NP-Complete Problems and Approximation Algorithms NP-Complete Problems and Approximation Algorithms Efficiency of Algorithms Algorithms that have time efficiency of O(n k ), that is polynomial of the input size, are considered to be tractable or easy

More information

10.3: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine.

10.3: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine. Overview 10.3: Intractability What is an algorithm? Turing machine. What problems can be solved on a computer? Computability. What ALGORITHMS will be useful in practice? Analysis of algorithms. Which PROBLEMS

More information

NP Complete Problems. COMP 215 Lecture 20

NP Complete Problems. COMP 215 Lecture 20 NP Complete Problems COMP 215 Lecture 20 Complexity Theory Complexity theory is a research area unto itself. The central project is classifying problems as either tractable or intractable. Tractable Worst

More information

Section #2: Linear and Integer Programming

Section #2: Linear and Integer Programming Section #2: Linear and Integer Programming Prof. Dr. Sven Seuken 8.3.2012 (with most slides borrowed from David Parkes) Housekeeping Game Theory homework submitted? HW-00 and HW-01 returned Feedback on

More information

More on NP and Reductions

More on NP and Reductions Indian Institute of Information Technology Design and Manufacturing, Kancheepuram Chennai 600 127, India An Autonomous Institute under MHRD, Govt of India http://www.iiitdm.ac.in COM 501 Advanced Data

More information

NP-Completeness. ch34 Hewett. Problem. Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g.

NP-Completeness. ch34 Hewett. Problem. Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g. NP-Completeness ch34 Hewett Problem Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g., O(2 n ) computationally feasible poly-time alg. sol. E.g., O(n k ) No

More information

Complexity - Introduction + Complexity classes

Complexity - Introduction + Complexity classes Complexity - Introduction + Complexity classes Computability - is a problem solvable? Part I: via Turing machines Part II: via Church s Lambda calculus..now.. Part III: Complexity is concerned with how

More information

Una descrizione della Teoria della Complessità, e più in generale delle classi NP-complete, possono essere trovate in:

Una descrizione della Teoria della Complessità, e più in generale delle classi NP-complete, possono essere trovate in: AA. 2014/2015 Bibliography Una descrizione della Teoria della Complessità, e più in generale delle classi NP-complete, possono essere trovate in: M. R. Garey and D. S. Johnson, Computers and Intractability:

More information

July 18, Approximation Algorithms (Travelling Salesman Problem)

July 18, Approximation Algorithms (Travelling Salesman Problem) Approximation Algorithms (Travelling Salesman Problem) July 18, 2014 The travelling-salesman problem Problem: given complete, undirected graph G = (V, E) with non-negative integer cost c(u, v) for each

More information

Spring Lecture 21 NP-Complete Problems

Spring Lecture 21 NP-Complete Problems CISC 320 Introduction to Algorithms Spring 2014 Lecture 21 NP-Complete Problems 1 We discuss some hard problems: how hard? (computational complexity) what makes them hard? any solutions? Definitions Decision

More information

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer Science University of Virginia www.cs.virginia.edu/~njb2b/theory

More information

A difficult problem. ! Given: A set of N cities and $M for gas. Problem: Does a traveling salesperson have enough $ for gas to visit all the cities?

A difficult problem. ! Given: A set of N cities and $M for gas. Problem: Does a traveling salesperson have enough $ for gas to visit all the cities? Intractability A difficult problem Traveling salesperson problem (TSP) Given: A set of N cities and $M for gas. Problem: Does a traveling salesperson have enough $ for gas to visit all the cities? An algorithm

More information

Intractability. A difficult problem. Exponential Growth. A Reasonable Question about Algorithms !!!!!!!!!! Traveling salesperson problem (TSP)

Intractability. A difficult problem. Exponential Growth. A Reasonable Question about Algorithms !!!!!!!!!! Traveling salesperson problem (TSP) A difficult problem Intractability A Reasonable Question about Algorithms Q. Which algorithms are useful in practice? A. [von Neumann 1953, Gödel 1956, Cobham 1964, Edmonds 1965, Rabin 1966] Model of computation

More information

CSE 548: (Design and) Analysis of Algorithms

CSE 548: (Design and) Analysis of Algorithms 1 / 38 CSE 548: (Design and) Analysis of Algorithms NP and Complexity Classes R. Sekar 2 / 38 Search and Optimization Problems Many problems of our interest are search problems with exponentially (or even

More information

SAT, Coloring, Hamiltonian Cycle, TSP

SAT, Coloring, Hamiltonian Cycle, TSP 1 SAT, Coloring, Hamiltonian Cycle, TSP Slides by Carl Kingsford Apr. 28, 2014 Sects. 8.2, 8.7, 8.5 2 Boolean Formulas Boolean Formulas: Variables: x 1, x 2, x 3 (can be either true or false) Terms: t

More information

The Complexity Classes P and NP. Andreas Klappenecker [partially based on slides by Professor Welch]

The Complexity Classes P and NP. Andreas Klappenecker [partially based on slides by Professor Welch] The Complexity Classes P and NP Andreas Klappenecker [partially based on slides by Professor Welch] P Polynomial Time Algorithms Most of the algorithms we have seen so far run in time that is upper bounded

More information

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013 Chapter 2 Reductions and NP CS 573: Algorithms, Fall 2013 August 29, 2013 2.1 Reductions Continued 2.1.1 The Satisfiability Problem SAT 2.1.1.1 Propositional Formulas Definition 2.1.1. Consider a set of

More information

Computational complexity theory

Computational complexity theory Computational complexity theory Introduction to computational complexity theory Complexity (computability) theory deals with two aspects: Algorithm s complexity. Problem s complexity. References S. Cook,

More information

Algorithms and Complexity theory

Algorithms and Complexity theory Algorithms and Complexity theory Thibaut Barthelemy Some slides kindly provided by Fabien Tricoire University of Vienna WS 2014 Outline 1 Algorithms Overview How to write an algorithm 2 Complexity theory

More information

The Traveling Salesman Problem: An Overview. David P. Williamson, Cornell University Ebay Research January 21, 2014

The Traveling Salesman Problem: An Overview. David P. Williamson, Cornell University Ebay Research January 21, 2014 The Traveling Salesman Problem: An Overview David P. Williamson, Cornell University Ebay Research January 21, 2014 (Cook 2012) A highly readable introduction Some terminology (imprecise) Problem Traditional

More information

A An Overview of Complexity Theory for the Algorithm Designer

A An Overview of Complexity Theory for the Algorithm Designer A An Overview of Complexity Theory for the Algorithm Designer A.1 Certificates and the class NP A decision problem is one whose answer is either yes or no. Two examples are: SAT: Given a Boolean formula

More information

Unit 1A: Computational Complexity

Unit 1A: Computational Complexity Unit 1A: Computational Complexity Course contents: Computational complexity NP-completeness Algorithmic Paradigms Readings Chapters 3, 4, and 5 Unit 1A 1 O: Upper Bounding Function Def: f(n)= O(g(n)) if

More information

Intro to Theory of Computation

Intro to Theory of Computation Intro to Theory of Computation LECTURE 25 Last time Class NP Today Polynomial-time reductions Adam Smith; Sofya Raskhodnikova 4/18/2016 L25.1 The classes P and NP P is the class of languages decidable

More information

Polynomial-Time Reductions

Polynomial-Time Reductions Reductions 1 Polynomial-Time Reductions Classify Problems According to Computational Requirements Q. Which problems will we be able to solve in practice? A working definition. [von Neumann 1953, Godel

More information

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2) Algorithms and Theory of Computation Lecture 22: NP-Completeness (2) Xiaohui Bei MAS 714 November 8, 2018 Nanyang Technological University MAS 714 November 8, 2018 1 / 20 Set Cover Set Cover Input: a set

More information

NP-Completeness. Subhash Suri. May 15, 2018

NP-Completeness. Subhash Suri. May 15, 2018 NP-Completeness Subhash Suri May 15, 2018 1 Computational Intractability The classical reference for this topic is the book Computers and Intractability: A guide to the theory of NP-Completeness by Michael

More information

Data Structures and Algorithms (CSCI 340)

Data Structures and Algorithms (CSCI 340) University of Wisconsin Parkside Fall Semester 2008 Department of Computer Science Prof. Dr. F. Seutter Data Structures and Algorithms (CSCI 340) Homework Assignments The numbering of the problems refers

More information

SAT, NP, NP-Completeness

SAT, NP, NP-Completeness CS 473: Algorithms, Spring 2018 SAT, NP, NP-Completeness Lecture 22 April 13, 2018 Most slides are courtesy Prof. Chekuri Ruta (UIUC) CS473 1 Spring 2018 1 / 57 Part I Reductions Continued Ruta (UIUC)

More information

Combinatorial Optimization

Combinatorial Optimization Combinatorial Optimization Problem set 8: solutions 1. Fix constants a R and b > 1. For n N, let f(n) = n a and g(n) = b n. Prove that f(n) = o ( g(n) ). Solution. First we observe that g(n) 0 for all

More information

CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010

CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010 CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010 Computational complexity studies the amount of resources necessary to perform given computations.

More information

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

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA. Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA NP Completeness Susmita Sur-Kolay Advanced Computing and Microelectronics Unit

More information

INTRO TO COMPUTATIONAL COMPLEXITY

INTRO TO COMPUTATIONAL COMPLEXITY MA/CSSE 473 Day 38 Problems Decision Problems P and NP Polynomial time algorithms INTRO TO COMPUTATIONAL COMPLEXITY 1 The Law of the Algorithm Jungle Polynomial good, exponential bad! The latter is obvious,

More information

NP Completeness and Approximation Algorithms

NP Completeness and Approximation Algorithms Winter School on Optimization Techniques December 15-20, 2016 Organized by ACMU, ISI and IEEE CEDA NP Completeness and Approximation Algorithms Susmita Sur-Kolay Advanced Computing and Microelectronic

More information

Computational complexity theory

Computational complexity theory Computational complexity theory Introduction to computational complexity theory Complexity (computability) theory deals with two aspects: Algorithm s complexity. Problem s complexity. References S. Cook,

More information

Nondeterministic Polynomial Time

Nondeterministic Polynomial Time Nondeterministic Polynomial Time 11/1/2016 Discrete Structures (CS 173) Fall 2016 Gul Agha Slides based on Derek Hoiem, University of Illinois 1 2016 CS Alumni Awards Sohaib Abbasi (BS 78, MS 80), Chairman

More information

CSC 8301 Design & Analysis of Algorithms: Lower Bounds

CSC 8301 Design & Analysis of Algorithms: Lower Bounds CSC 8301 Design & Analysis of Algorithms: Lower Bounds Professor Henry Carter Fall 2016 Recap Iterative improvement algorithms take a feasible solution and iteratively improve it until optimized Simplex

More information

The P-vs-NP problem. Andrés E. Caicedo. September 10, 2011

The P-vs-NP problem. Andrés E. Caicedo. September 10, 2011 The P-vs-NP problem Andrés E. Caicedo September 10, 2011 This note is based on lecture notes for the Caltech course Math 6c, prepared with A. Kechris and M. Shulman. 1 Decision problems Consider a finite

More information

PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE

PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE Artificial Intelligence, Computational Logic PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE Lecture 4 Metaheuristic Algorithms Sarah Gaggl Dresden, 5th May 2017 Agenda 1 Introduction 2 Constraint

More information

Turing Machines and Time Complexity

Turing Machines and Time Complexity Turing Machines and Time Complexity Turing Machines Turing Machines (Infinitely long) Tape of 1 s and 0 s Turing Machines (Infinitely long) Tape of 1 s and 0 s Able to read and write the tape, and move

More information

ECS 120 Lesson 24 The Class N P, N P-complete Problems

ECS 120 Lesson 24 The Class N P, N P-complete Problems ECS 120 Lesson 24 The Class N P, N P-complete Problems Oliver Kreylos Friday, May 25th, 2001 Last time, we defined the class P as the class of all problems that can be decided by deterministic Turing Machines

More information

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

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch] NP-Completeness Andreas Klappenecker [based on slides by Prof. Welch] 1 Prelude: Informal Discussion (Incidentally, we will never get very formal in this course) 2 Polynomial Time Algorithms Most of the

More information

CMPT307: Complexity Classes: P and N P Week 13-1

CMPT307: Complexity Classes: P and N P Week 13-1 CMPT307: Complexity Classes: P and N P Week 13-1 Xian Qiu Simon Fraser University xianq@sfu.ca Strings and Languages an alphabet Σ is a finite set of symbols {0, 1}, {T, F}, {a, b,..., z}, N a string x

More information

Edge Elimination for the Hamiltonian Cycle problem

Edge Elimination for the Hamiltonian Cycle problem Edge Elimination for the Hamiltonian Cycle problem Elliot Catt Pablo Moscato and Luke Mathieson University of Newcastle February 27, 2017 1 Abstract The Hamilton cycle and travelling salesman problem are

More information

CS 6505, Complexity and Algorithms Week 7: NP Completeness

CS 6505, Complexity and Algorithms Week 7: NP Completeness CS 6505, Complexity and Algorithms Week 7: NP Completeness Reductions We have seen some problems in P and NP, and we ve talked about space complexity. The Space Hierarchy Theorem showed us that there are

More information

ECS122A Handout on NP-Completeness March 12, 2018

ECS122A Handout on NP-Completeness March 12, 2018 ECS122A Handout on NP-Completeness March 12, 2018 Contents: I. Introduction II. P and NP III. NP-complete IV. How to prove a problem is NP-complete V. How to solve a NP-complete problem: approximate algorithms

More information

NP-Completeness. NP-Completeness 1

NP-Completeness. NP-Completeness 1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979. NP-Completeness 1 General Problems, Input Size and

More information

Computational Complexity

Computational Complexity Computational Complexity Algorithm performance and difficulty of problems So far we have seen problems admitting fast algorithms flow problems, shortest path, spanning tree... and other problems for which

More information

CS 583: Algorithms. NP Completeness Ch 34. Intractability

CS 583: Algorithms. NP Completeness Ch 34. Intractability CS 583: Algorithms NP Completeness Ch 34 Intractability Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time? Standard working

More information

Graph Theory and Optimization Computational Complexity (in brief)

Graph Theory and Optimization Computational Complexity (in brief) Graph Theory and Optimization Computational Complexity (in brief) Nicolas Nisse Inria, France Univ. Nice Sophia Antipolis, CNRS, I3S, UMR 7271, Sophia Antipolis, France September 2015 N. Nisse Graph Theory

More information

Introduction. Pvs.NPExample

Introduction. Pvs.NPExample Introduction Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 09 NP-Completeness (Chapter 34) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu I

More information

COP 4531 Complexity & Analysis of Data Structures & Algorithms

COP 4531 Complexity & Analysis of Data Structures & Algorithms COP 4531 Complexity & Analysis of Data Structures & Algorithms Lecture 18 Reductions and NP-completeness Thanks to Kevin Wayne and the text authors who contributed to these slides Classify Problems According

More information

Automata Theory CS S-18 Complexity Theory II: Class NP

Automata Theory CS S-18 Complexity Theory II: Class NP Automata Theory CS411-2015S-18 Complexity Theory II: Class NP David Galles Department of Computer Science University of San Francisco 18-0: Language Class P A language L is polynomially decidable if there

More information

NP-Complete Problems. More reductions

NP-Complete Problems. More reductions NP-Complete Problems More reductions Definitions P: problems that can be solved in polynomial time (typically in n, size of input) on a deterministic Turing machine Any normal computer simulates a DTM

More information