DP TSP Have some numbering of the vertices We will think of all our tours as beginning and ending at 1 C(S, j) = length of shortest path visiting each.

Slides:



Advertisements
Similar presentations
Hard Problems Some problems are hard to solve. No polynomial time algorithm is known Most combinatorial optimization problems are hard Popular NP-hard.
Advertisements

Limitation of Computation Power – P, NP, and NP-complete
Instructor Neelima Gupta Table of Contents Approximation Algorithms.
Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
Lecture 24 Coping with NPC and Unsolvable problems. When a problem is unsolvable, that's generally very bad news: it means there is no general algorithm.
Reducibility Class of problems A can be reduced to the class of problems B Take any instance of problem A Show how you can construct an instance of problem.
1 NP-completeness Lecture 2: Jan P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many.
1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell ( )
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
1 Optimization problems such as MAXSAT, MIN NODE COVER, MAX INDEPENDENT SET, MAX CLIQUE, MIN SET COVER, TSP, KNAPSACK, BINPACKING do not have a polynomial.
Approximation Algorithms Lecture for CS 302. What is a NP problem? Given an instance of the problem, V, and a ‘certificate’, C, we can verify V is in.
Transitivity of  poly Theorem: Let ,  ’, and  ’’ be three decision problems such that   poly  ’ and  ’  poly  ’’. Then  poly  ’’. Proof:
The Theory of NP-Completeness
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
Analysis of Algorithms CS 477/677
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Odds and Ends HP ≤ p HC (again) –Turing reductions Strong NP-completeness versus Weak NP-completeness Vertex Cover to Hamiltonian Cycle.
Approximation Algorithms Motivation and Definitions TSP Vertex Cover Scheduling.
1 NP-Complete Problems (Fun part) Polynomial time vs exponential time –Polynomial O(n k ), where n is the input size (e.g., number of nodes in a graph,
Approximation Algorithms
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Programming & Data Structures
NP-Complete Problems CSC 331: Algorithm Analysis NP-Complete Problems.
Scott Perryman Jordan Williams.  NP-completeness is a class of unsolved decision problems in Computer Science.  A decision problem is a YES or NO answer.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
1 The TSP : NP-Completeness Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell.
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
Princeton University COS 423 Theory of Algorithms Spring 2001 Kevin Wayne Approximation Algorithms These lecture slides are adapted from CLRS.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Unit 9: Coping with NP-Completeness
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness and course wrap up.
NP-Complete problems.
WK15. Vertex Cover and Approximation Algorithm By Lin, Jr-Shiun Choi, Jae Sung.
Hard Problems Sanghyun Park Fall 2002 CSE, POSTECH.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 30, 2014.
Algorithms for hard problems Introduction Juris Viksna, 2015.
NP Completeness Piyush Kumar. Today Reductions Proving Lower Bounds revisited Decision and Optimization Problems SAT and 3-SAT P Vs NP Dealing with NP-Complete.
CSC 413/513: Intro to Algorithms
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
Algorithm Complexity By: Ashish Patel and Alex Golebiewski.
Exhaustive search Exhaustive search is simply a brute- force approach to combinatorial problems. It suggests generating each and every element of the problem.
Hard Problems Some problems are hard to solve.  No polynomial time algorithm is known.  E.g., NP-hard problems such as machine scheduling, bin packing,
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
The Theory of NP-Completeness
Limitation of Computation Power – P, NP, and NP-complete
More NP-complete problems
Hard Problems Some problems are hard to solve.
Richard Anderson Lecture 26 NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
Hamiltonian Cycle and TSP
Design and Analysis of Algorithm
Approximation Algorithms
Computability and Complexity
ICS 353: Design and Analysis of Algorithms
Richard Anderson Lecture 28 NP-Completeness
Richard Anderson Lecture 28 Coping with NP-Completeness
Approximation Algorithms
Richard Anderson Lecture 30 NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
The Theory of NP-Completeness
Richard Anderson Lecture 27 Survey of NP Complete Problems
Lecture 24 Vertex Cover and Hamiltonian Cycle
Presentation transcript:

DP TSP Have some numbering of the vertices We will think of all our tours as beginning and ending at 1 C(S, j) = length of shortest path visiting each node in S exactly once, starting at 1 and ending at j. 1 and j are part of S. C({1}, 1) = ?

C(S, j) = length of shortest path visiting each node in S exactly once, starting at 1 and ending at j. C(S,j) can be determined if we focus on the second last city. Let us call that one i. Where the last term is the distance between i and j.

Python implementationPython implementation - Very cool and uses list comprehensions to the max (which any true geek would!) What is the running time/complexity?

List of known NP Complete problems Graph theory – Cliques – Vertex cover – Chromatic number of graph (smallest number of colours needed to colour the graph) – Hamiltonian cycle – TSP – Longest path problem (can be reduced from Hamiltonian cycle. Think about how). Also known as the ‘taxicab ripoff’ problem

Sequencing Deadlines for tasks A set T of tasks; for each task t in T: a positive integer length len(t) - how long they run for a positive integer release time r(t) – when the task is available for the processor to do a positive integer deadline d(t) – the task has to be completed by this time Is there a one-processor schedule for tasks that satisfies the release time constraints and meets all the deadlines?

0/1 Knapsack You have a bag with limited capacity (total weight that can be put into it) You have an array of items each with a certain weight and certain value Once you pick an item you have to put the whole item into your bag (No cutting it into pieces!) Maximize value

0-1 programming Maximize returns subject to resource constraints Assume the returns on the j th investment are c j Assume you can only spend b i money in total

NP Completeness in ‘everyday’ life Assigning university classes to timeslots to minimize scheduling conflicts Wedding planning where you want to seat friends together at the same table but not any enemies (along the lines of CLIQUE)

NP complete problems Painful to solve Even when we reduce complexity (by DP for instance) we still have non polynomial run times But these are practical problems! How to solve? – Approximation algorithms – Heuristics – Randomized algorithms They are ‘unsolved’ so new and interesting results can be shown about them. People pay good money for solving these problems

C← ∅ while E = ∅ pick any {u, v} ∈ E C ← C ∪ {u, v} delete all edges incident to either u or v return C Approximation algorithm for Vertex cover

How bad is that approximation? Look at the edges returned in that algorithm Will the optimum vertex cover include at least one end point of the edges returned from approx algorithm?

Genetic algorithm for TSP Your last HW Has very little to do with this course other than the fact that it is an NP-complete problem and this is one way to solve it. Hopefully will be fun

High level idea of genetic algorithm Start with a set of solutions (population) Create offspring (this is the crossover operation) Probabilistically create mutations Hope that the offspring is ‘fitter’ Why should this work? – Huge debates  – Seems to work in practice