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

Similar documents
Computational Complexity

COSE215: Theory of Computation. Lecture 20 P, NP, and NP-Complete Problems

Turing Machines and Time Complexity

Introduction to Complexity Theory

COSE215: Theory of Computation. Lecture 21 P, NP, and NP-Complete Problems

NP Complete Problems. COMP 215 Lecture 20

Review of unsolvability

Complexity Theory. Knowledge Representation and Reasoning. November 2, 2005

Computational Complexity

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

Limitations of Algorithm Power

Complexity - Introduction + Complexity classes

Lecture 25: Cook s Theorem (1997) Steven Skiena. skiena

Tractability. Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time?

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.

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

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

6-1 Computational Complexity

CS151 Complexity Theory. Lecture 1 April 3, 2017

Analysis of Algorithms. Unit 5 - Intractable Problems

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size.

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k.

CS154, Lecture 17: conp, Oracles again, Space Complexity

Intractable Problems [HMU06,Chp.10a]

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

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

Friday Four Square! Today at 4:15PM, Outside Gates

Computability and Complexity Theory

Introduction to Turing Machines. Reading: Chapters 8 & 9

NP-completeness. Chapter 34. Sergey Bereg

The purpose here is to classify computational problems according to their complexity. For that purpose we need first to agree on a computational

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

Computability and Complexity Theory: An Introduction

Q = Set of states, IE661: Scheduling Theory (Fall 2003) Primer to Complexity Theory Satyaki Ghosh Dastidar

Space Complexity. The space complexity of a program is how much memory it uses.

P,NP, NP-Hard and NP-Complete

Design and Analysis of Algorithms

Problems, and How Computer Scientists Solve Them Manas Thakur

Comparison of several polynomial and exponential time complexity functions. Size n

CMSC 441: Algorithms. NP Completeness

NP-Completeness. NP-Completeness 1

Complexity Theory Part I

NP Completeness and Approximation Algorithms

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

Theory of Computation Lecture Notes. Problems and Algorithms. Class Information

CSE 105 THEORY OF COMPUTATION

Spring Lecture 21 NP-Complete Problems

Computability Theory. CS215, Lecture 6,

Computer Sciences Department

conp, Oracles, Space Complexity

Principles of Knowledge Representation and Reasoning

Definition: conp = { L L NP } What does a conp computation look like?

Final exam study sheet for CS3719 Turing machines and decidability.

Chapter 2 : Time complexity

The P versus NP Problem. Dean Casalena University of Cape Town CSLDEA001

Computability and Complexity CISC462, Fall 2018, Space complexity 1

Acknowledgments 2. Part 0: Overview 17

Turing Machines Part III

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

CSC 1700 Analysis of Algorithms: P and NP Problems

Lecture Notes 4. Issued 8 March 2018

Time Complexity (1) CSCI Spring Original Slides were written by Dr. Frederick W Maier. CSCI 2670 Time Complexity (1)

Computational Models Lecture 11, Spring 2009

The Turing Machine. Computability. The Church-Turing Thesis (1936) Theory Hall of Fame. Theory Hall of Fame. Undecidability

Introduction to Computational Complexity

Beyond NP [HMU06,Chp.11a] Tautology Problem NP-Hardness and co-np Historical Comments Optimization Problems More Complexity Classes

Correctness of Dijkstra s algorithm

BBM402-Lecture 11: The Class NP

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

On the Computational Hardness of Graph Coloring

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

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

13.1 Nondeterministic Polynomial Time

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

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

34.1 Polynomial time. Abstract problems

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

Decidability: Church-Turing Thesis

COMPLEXITY THEORY. Lecture 17: The Polynomial Hierarchy. TU Dresden, 19th Dec Markus Krötzsch Knowledge-Based Systems

CS154, Lecture 13: P vs NP

Lecture 4: NP and computational intractability

Computational complexity theory

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness

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

Intro to Theory of Computation

Problems and Solutions. Decidability and Complexity

1. Introduction Recap

CS6901: review of Theory of Computation and Algorithms

Theory of Computation

Data Structures in Java

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

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

CS154, Lecture 13: P vs NP

CS3719 Theory of Computation and Algorithms

The Beauty and Joy of Computing

Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis

CS 583: Algorithms. NP Completeness Ch 34. Intractability

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

Transcription:

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 Multi-Criteria Optimization Pareto Optimality 2

Length of the minimal Tour = 27 3

4

Inherently Intractable problems 5

Exponential vs. Polynomial Growth 6

Can Faster Computers Help? 7

Can we Live with Suboptimal Solutions? Only if suboptimal does not mean "arbitrarily bad" rule-based assignment of passengers led to very low transportation capacity preventing market acceptance of the system an ordering algorithm often finds no solution many solutions turn out to perform very poor in practices control is manually developed restricting the systems to a mass market seqment 8

An Informal Notion of Computability We have an intuitive notion of an algorithm that can compute a result over some input we can encode the input in the natural numbers 1,, n our algorithm (Java programm) will compute a function f Given the input x 1, x 2,, x n the arguments of the function f, the algorithm should stop returning f(x 1, x 2,, x n ) after a finite amount of steps If f is a partial function (undefined for some of its arguments), the algorithm should loop infinitely (not stop) Can we formalize this notion? 9

Turing Machine Explained 41- https://www.youtube.com/watch?v=dnrdvlacg5q 10

Turing Machine 11

Example States Q = z 0, z e Blank Input symbols Σ= 0,1, Tape symbols Γ= 0,1, Inital state q 0 = z 0 Accepting final states F = {z e } transition function δ δ(z 0,0) = (z 0,0,R) δ(z 0,1) = (z 0,1,R) δ(z 0, ) = (z e,,l) 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 12

A Working Turing Machine 42 - https://www.youtube.com/watch?v=e3kelemwfhy 13

Deterministic and Non-Deterministic Turing Machines Deterministic Turing machine (DTM): the set of rules prescribes at most one action to be performed for any given situation Non-deterministic Turing machine (NTM): may have a set of rules that prescribes more than one action for a given situation δ(z 0,0) = (z 0,0,R) δ(z 0,1) = (z 0,1,R) δ(z 0, ) = (z e,,l) δ is function δ(z 0,0) = (z 0,0,R) δ(z 0,0) = (z 0,0,L) δ(z 0,1) = (z 0,1,R) δ is a relation δ(z 0,1) = (z 0,0,R) Every Non-Deterministic TM (NDM) can be simulated by a Deterministic TM (DTM)! 14

Church's Thesis The formal definition of Turing-Computability captures exactly the class if intuitively computable functions. 15

The Problems computed by DTM and NTM An NTM only needs to have(!) some sequence of choices that results in "yes" to accept an input The length of an accepting computation of the DTM is, in general, exponential in the length of the shortest accepting computation of the NTM DTM needs to simulate all possible sequences of choices n! for n transition rules general property of simulations of NTMs by DTMs 16

The complexity Classes P and NP P = set of problems, a DTM can solve in polynomial time NP = set of problems, a NTM can solve in polynomial time an NTM always picks the best nondeterministic transition and ends in an accepting end state in an amount of time bounded polynomially on the size of the input Our computers (algorithms) are DTMs, hence they need exponential time on problems in NP! they have to explore all possible sequences in the worst case 17

P vs NP Video 43 - https://www.youtube.com/watch?v=yx40hbahx3s&spfreload=10 18

Example: The Subset Sum problem is in NP Given a set of integers, does some nonempty subset of them sum to 0? s= { 2, 3, 15, 14, 7, 10} yes! x = { 2, 3, 15, 10} because 2 + 3 + 10 + 15 =0 It is easy (in polynomial time) to verify that x is a solution To find this solution, 2 n -1 tries (all non-empty) subsets have to be tried, enumerating this exponential set takes exponential time An NTM can nondeterministically pick the sequence of transitions that directly generate this set, a DTM cannot 19

Decision Problems I. Given a set of integers, does some nonempty subset of them sum to 0? II. Does the Turing machine M halt on input x (Halteproblem)? III. Does x evenly divide y? Decision Procedure: method for solving a decision problem, given in the form of an algorithm I. Try all nonempty sum subsets, if there is one that equals 0, answer yes, otherwise no II.???? if the machine stops, ok, but what if not???? III. If the division algorithm returns the remainder 0, the answer is yes, otherwise it is no 20

Complete Decision Problems Decision problems, which can be solved by an algorithm, are called decidable A decision problem x is said to be complete for a set of decision problems S if x is a member of S and every problem s in S can be reduced to x Reduce a problem s in S to x any instance of the problem s can be transformed to an equivalent instance of x any algorithm that solves x can be transformed to solve s Polynomial-time reductions construct polynomial-time algorithms from polynomial-time algorithms 21

NP-Completeness (Cook 1971) Demonstrated P-time reductions Defined the class of NP problems and phrased them as decision problems Showed that every problem in NP can be P-time reduced to the Satisfiability problem, which is also in NP any algorithm for SAT will solve any other NP problem SAT is NP-hard A decision problem is NP-complete if it is in NP and it is NP-hard or if another NP-complete problem reduces to it 22

A SAT Problem Instance Given a formula in propositional logic, is there an assignment of truth values which makes the formula true? SAT solving is a hot AI-related research area 23

NP-Completeness Complete decision problems are used in computational complexity to characterize complexity classes of decision problems membership: SAT is in NP hardness: SAT is NP-hard Unless P=NP, there is no poynomial time solution for SAT 24

The Theory of NP-Completeness gives us at least 25

Examples of NP-complete Problems Subgraph Isomorphism Given 2 graphs G and H, does G contain a subgraph isomorph to H? Traveling Salesman Given a number of cities, a distance for each pair of cities, does there exist a tour of all cities no longer than k? 26

Between P-complete and NP-complete Graph Isomorphism Are two graphs G and H isomorph to each other? Integer factorization or prime factorization Is there a decomposition of an integer into smaller nontrivial divisors, which when multiplied together equal the original integer? No polynomial-time algorithms known Could not be proven yet to be NP-complete 27

The Halting Problem 44 - https://www.youtube.com/watch?v=92whn-pafcs 28

Our Current Complexity Map EXPTIME co-np complement of NP PSPACE P NP 29 AI is usually concerned with NP-hard problems

The Class PSPACE Set of all decision problems solvable by a deterministic Turing machine using a polynomial amount of space in the length of the input length of the solution must be polynomially bounded Examples Given a regular expression R, does it generate every string over its alphabet? Word problem for deterministic context-sensitive grammars Games (when played on an n n board): hex, Reversi, Rush Hour, Mahjong, Atomix, Sokoban the game can only last for a polynomial number of moves 32

The Class EXPTIME Set of all decision problems solvable by a deterministic Turing machine in exponential time in the size of the input the solution length is NOT polynomially bounded Checkers, GO, Chess the game can last for an exponential number of moves Does a DTM halt in at most k steps? 33

Towers of Hanoi A simple EXPTIME Problem Rebuild the tower on poole C using poole B for intermediate positions of n disks. the length of the shortest solution is A B C 34

Hard and Easy Problem Instances Complexity theory gives us a worst-case result! does not say anything about the difficulty of specific instances of a problem 35

From Decision to Optimization Problems Traveling Salesman Given a number of cities, a distance for each pair of cities, does there exist a tour of all cities no longer than k? k is an input parameter on a yes/no question does not necessarily require to compute the tour Optimizing TSP Given a number of cities, a distance for each pair of cities, find the shortest tour of all cities need to find a tour and show that no other tour is shorter 36

TSP Is there a tour of length < 50? clearly not! Is there a tour of length < 2500? What is the length of the shortest tour? 37

How can I recognize an NP-hard Problem in Practice? The problem is difficult to describe There is confusion about what really constitutes the problem Experts have different opinions on what is a good solution to the problem There seem to be many possible solutions to a problem When implementing, the code seems to require to explore many alternatives 38

Summary There are inherently intractable problems! these problems cannot be optimally solved without investing an effort exponential in the size of the problem instance they occur more often in practice and are not so easy to recognize Exponential growth cannot be compensated by adding more computational power! Giving up completeness is an option, but we need to be aware that solution quality can become arbitrarily bad! Be careful when designing optimization criteria, they may not only have the desired effects! 44