Hard problems in computer science Prof. Noah Snavely CS1114

Slides:



Advertisements
Similar presentations
Instructor Neelima Gupta Table of Contents Approximation Algorithms.
Advertisements

Graph algorithms Prof. Noah Snavely CS1114
Shortest Paths Text Discrete Mathematics and Its Applications (5 th Edition) Kenneth H. Rosen Chapter 9.6 Based on slides from Chuck Allison, Michael T.
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.
Approximation Algorithms for TSP
1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell ( )
The Theory of NP-Completeness
CPE702 Complexity Classes Pruet Boonma Department of Computer Engineering Chiang Mai University Based on Material by Jenny Walter.
Approximation Algorithms for Orienteering and Discounted-Reward TSP Blum, Chawla, Karger, Lane, Meyerson, Minkoff CS 599: Sequential Decision Making in.
Introduction to Approximation Algorithms Lecture 12: Mar 1.
Clustering and greedy algorithms — Part 2 Prof. Noah Snavely CS1114
Approximation Algorithms: Combinatorial Approaches Lecture 13: March 2.
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.
1 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.
The Theory of NP-Completeness
CHAPTER 10 P and NP. Algorithm Crossword Puzzle This algorithm solves a crossword puzzle, represented by a Boolean matrix D[i,j], 1 = i,j = n,
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Clustering and greedy algorithms Prof. Noah Snavely CS1114
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
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
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.
Difficult Problems. Polynomial-time algorithms A polynomial-time algorithm is an algorithm whose running time is O(f(n)), where f(n) is a polynomial A.
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.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
Modular Arithmetic Shirley Moore CS4390/5390 Fall September 3, 2013.
CSC 172 P, NP, Etc. “Computer Science is a science of abstraction – creating the right model for thinking about a problem and devising the appropriate.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
Optimization revisited Prof. Noah Snavely CS1114
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
Erdal Kose CC30.10 These slides are based of Prof. N. Yanofsky Lecture notes.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
Beauty and Joy of Computing Limits of Computing Ivona Bezáková CS10: UC Berkeley, April 14, 2014 (Slides inspired by Dan Garcia’s slides.)
Approximation Algorithms for TSP Tsvi Kopelowitz 1.
Shortest Paths Text Discrete Mathematics and Its Applications (5 th Edition) Kenneth H. Rosen Chapter 8.6 Based on slides from Chuck Allison, Michael T.
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
MCS 312: NP Completeness and Approximation algorthms Instructor Neelima Gupta
Week 13 - Monday.  What did we talk about last time?  B-trees  Hamiltonian tour  Traveling Salesman Problem.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 15: Intractable Problems (Smiley.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Lecture 7 Jianjun Hu Department of Computer Science and Engineering University of South Carolina CSCE350 Algorithms and Data Structure.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Computer Science: An Overview Eleventh Edition by J. Glenn Brookshear Chapter.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
David Stotts Computer Science Department UNC Chapel Hill.
David Luebke 1 2/18/2016 CS 332: Algorithms NP Completeness Continued: Reductions.
CSC 413/513: Intro to Algorithms
1 The Theory of NP-Completeness 2 Review: Finding lower bound by problem transformation Problem X reduces to problem Y (X  Y ) iff X can be solved by.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
Exhaustive search Exhaustive search is simply a brute- force approach to combinatorial problems. It suggests generating each and every element of the problem.
1 Minimum Spanning Tree: Solving TSP for Metric Graphs using MST Heuristic Soheil Shafiee Shabnam Aboughadareh.
CSC 172 P, NP, Etc.
The Theory of NP-Completeness
Chapter 12: Theory of Computation
Shortest Path Problems
Richard Anderson Lecture 26 NP-Completeness
Optimization problems such as
Lecture 2-2 NP Class.
An introduction to Approximation Algorithms Presented By Iman Sadeghi
Unsolvable Problems December 4, 2017.
Lecture 5 NP Class.
Approximation Algorithms for TSP
Lecture 24 NP-Complete Problems
Approximation Algorithms
Chapter 11 Limitations of Algorithm Power
The Theory of NP-Completeness
Lecture 24 Vertex Cover and Hamiltonian Cycle
Presentation transcript:

Hard problems in computer science Prof. Noah Snavely CS1114

Administrivia  Assignments: –A6 due Friday  Prelim 3 next Thursday –Review in class Tuesday  Final project proposals –Most of you now have feedback –Demo session on Tuesday, May 15, 1:30-3:30 2

Puzzle  Does this program terminate? i = 0; while true i = i + 1; end 3

Puzzle  How about this one? c = 2; while true for a = 2:c for b = 2:c if a^3 + b^3 == c^3 return; end c = c + 1; end 4

Hard problems in computer science  Many problems in computer science are “polynomial time” problems –We know of an algorithm that solves the problem exactly in O(n k ) time, for some constant k –Examples?  Many other problems have no known polynomial time algorithm –E.g., problems whose fastest known algorithm takes O(2 n ) time [exponential time] 5

 Other problems cannot be solved at all in general –Given a program written in Matlab, does that program ever terminate? –A version of the halting problem –Vaguely related to the puzzle a moment ago 6 Hard problems in computer science

Exponential time algorithms  Many other problems have no known polynomial time algorithm –E.g., algorithms whose best solution takes O(2 n ) time  If it takes 1 second to solve such a problem with n = 100  Then it takes 2 seconds to solve for n = 101  And it takes 2 50 seconds to solve for n = 150 –About 3.6 million years 7

Travelling Salesman Problem (TSP)  Classic hard problem in CS  Problem statement: –Given a weighted, complete graph with n nodes –Compute a tour that starts and ends at the same nodes, and visits all other nodes –Find such a tour that has the lowest total cost –A tour is also just a permutation of the nodes 8

Subway challenge 9

Solving the TSP  What kind of algorithm might solve the TSP?  Can you come up with an example that breaks your algorithm? 10

Solving the TSP  What if the graph is metric? –Means that nodes could be laid out on the plane, with weights corresponding to distance in the plane  Easy to find a good approximation algorithm (on board) 11

12

Other hard problems in CS  Hamiltonian cycle –Does a given graph contain a Hamiltonian cycle? –(Very related to TSP)  Graph coloring –Can a given graph be colored with k colors? 13

Other hard problems in CS  Sudoku on n 2 x n 2 boards of n x n blocks  General algorithm for solving Sudoku? 14