np completeness n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
NP-Completeness PowerPoint Presentation
Download Presentation
NP-Completeness

Loading in 2 Seconds...

play fullscreen
1 / 39

NP-Completeness - PowerPoint PPT Presentation


  • 89 Views
  • Uploaded on

NP-Completeness. Objectives : At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC problem into another NPC problem 3. Show a given problem is in NPC 4. Solve a problem using an approximate solution. Content.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'NP-Completeness' - bob


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
np completeness
NP-Completeness

Objectives:

At the end of the lesson, students should be able to:

1. Differentiate between class P, NP, and NPC

2. Reduce a known NPC problem into another NPC problem

3. Show a given problem is in NPC

4. Solve a problem using an approximate solution.

content
Content
  • Informal introduction

- the classes P, NP and NP-complete

- the graph colouring

  • polynomial reductions
  • Approximation algorithms

- travelling salesman problem

slide6

Tractable vs intractable

Problems that can be solved in poly time are

called tractable

undecidable problem
Undecidable Problem
  • Decidable (P or NP)
  • Undecidable problem – e.g Halting Problem

Given a computer program and input to it, determine whether the program will halt on that input or continue working indefinitely on it.

a problem in npc
A Problem in NPC

How to show that a problem is in NPC?

Prove that no efficient algorithm is likely to exist.

Three key concepts for showing whether a problem is in NPC

1.Decision problems vs optimisation problems

2.Polynomial reductions

3.An initial NPC-problem

graph colouring
Graph colouring

This algorithm finds a k-colouring of G=(V,E), if there is one, and stores it in the array c.

Graph-colouring(G,k) {

For each v in V

c[v] = guess({1,2,…,k})

For each v in V

For each w in N(v)

if (c[w] ==c[v]

return false

return true

}

other complexity classes
Other complexity classes
  • There are many complexity classes that are much harder than NP.
  • PSPACE. Problems that can be solved using a reasonable amount of memory without regard to how much time the solution takes.
  • EXPTIME. Problems that can be solved in exponential time.
  • Undecidable. For some problems, we can prove that there is no algorithm that always solves them, no matter how much time or space is allowed.
some np complete problems
Some NP-complete problems
  • Does a given undirected graph have a Hamiltonian cycle?
  • Traveling salesman problem (TSP)
  • Graph coloring
tsp is in np
TSP is in NP
  • Given an instance to the TSP problem, use as “proposed solution” the sequence of n vertices in the tour e.g. ACDBA, ACDA.
  • Check that this sequence contains every vertex exactly once. ACDBA is yes, ACDA is no.
  • Sum up the edge costs and check whether this is at most k. Total cost for ACDBA = 35+12+10+20 = 77.

This can all be done in polynomial-time, ths TSP ε NP.

complete graphs
Complete Graphs
  • there is an edge “between” every possible tuple of vertices. |e| = C(n,2) = n. (n-1)/2
reduction of hc to tsp
Reduction of HC to TSP

G has a Hamiltonian cycle ↔ G’ has a tour of

cost at most 0

Suppose G has a Hamiltonian

cycle h. Then each edge in h

has cost 0 in G’.

Thus h is a tour of cost 0 in G’.

Suppose G’ has a tour h’ of cost at

most 0. As all edges in G’ have

cost 0 or 1, cost(h’) = 0, hence all edges in h’

have cost 0. Therefore, h’ is a hamiltonian cycle of G.

summary
Summary

1. Problems fall into class P, NP, and NPC.

2. Reduction of a known NPC problem into another NPC problem (Hcycle≤p TSP)

3. Shown a given problem is in NPC (TSP)

4. Solved a problem using an approximate solution.

Last updated: 2/11/2010.