LectureNotes24 - ECS 120 Lesson 24 The Class NP ,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ECS 120 Lesson 24 The Class NP , NP-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 in polynomial time. We also discovered that nondeterministic Turing Machines are more powerful than deterministic ones they recognize the same class of languages, but convert- ing an NTM into a DTM increases the running-time exponentially. Thus, we suspect that the class of languages recognized by NTMs in polynomial time contains more complex problems than found in P . 1 The Class NP We define the class NP analogously to P : Definition 1 (The Class NP ) NP := L * M,k : L is decided by NTM M in time O ( n k ) is the class of all languages that are decided by nondeterministic Turing Machines in polynomial time. To show that a problem is in NP , we have to give a nondeterministic algorithm that decides it, and we have to show that the algorithm runs in polynomial time O ( n k ). From the conversion algorithm NTM DTM we know that there exists a DTM that decides the same language in exponential time 2 O ( n k ) . Since we cannot build nondeterministic Turing Machines (yet), the only practical way to decide NP problems we know of now is using the exponential algorithm constructed by the conversion. These algorithms are unusable but for the smallest problem sizes, which leads to our notion that problems in NP \ P are intractable . There is strong evidence for this belief, but it has not been proved yet. 1 2 An Example Problem in NP To see how NP problems are typically solved, let us look at an example that is important in operations research: The Traveling Salesman Problem (TSP). Its task is as following: Given a directed weighted graph G , is there a round- trip in the graph such that the sum of weights on the edges traversed is not more than a given k ? To be more precise, a weighted graph G is a triple G = ( V,E,w ), where V is a (finite) set of nodes, E V V is a set of directed edges, and w : E R + is a function returning a (positive) weight for each edge in E . The definition of E is that two nodes v 1 ,v 2 V are connected by an edge from v 1 to v 2 , if and only if the pair ( v 1 ,v 2 ) E is an element of the set of edges. A round-trip in a graph with n nodes is a sequence of n + 1 nodes ( v ,v 1 ,...,v n ) V n +1 such that the first node is identical to the last one, v = v n , that all nodes in V appear in the sequence, { v ,v 1 ,...,v n } = V , and that all adjacent nodes in the sequence are connected by edges, i = 1 , 2 ,...,n : ( v i- 1 ,v i ) E . Less formally, a round-trip starts at some node, visits all other nodes in the graph exactly once and then comes back to the start node, while only following edges in the graph....
View Full Document

Page1 / 10

LectureNotes24 - ECS 120 Lesson 24 The Class NP ,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online