Undecidability & Intractable Problems - : Sunday, April 10, 2022 1
Undecidability & Intractable Problems - : Sunday, April 10, 2022 1
Intractable Problems
M
Accept Accept
Input M
Reject Reject
M
M1 Accept Accept
Input
M2 Accept Reject
Sunday, April 10, 2022 9
Recursive
Recursively
Enumerable (RE)
Non-recursively
Enumerable (Non-RE)
PC-solution: A2 A1 A3 B2 B1 B3
11100111
Tractable:
Set of all problems that can be solved in polynomial time are
called Tractable problem.
Intractable:
Set of all problems that can’t be solved in polynomial time are
called Intractable problem.
Sunday, April 10, 2022 24
Optimization & Decision Problems
• Decision problems
– Given an input and a question regarding a problem,
determine if the answer is yes or no.
• Optimization problems
– Find a solution with the “best” value.
• Optimization problems can be cast as decision
problems that are easier to study
– E.g.: Shortest path: G = unweighted directed graph
• Find a path between u and v that uses the fewest edges
Sunday, April 10, 2022 25
Class of “P” Problems
• Class P consists of (decision) problems that are
solvable in polynomial time
• Polynomial-time algorithms
– Worst-case running time is O(nk), for some constant k
(where n is the size of the input to the problem)
• Examples of polynomial time:
– O(n2), O(n3), O(1), O(n log n)
• Examples of non-polynomial time:
– O(2n), O(nn), O(n!)
Sunday, April 10, 2022 26
Tractable/Intractable Problems
• Problems in P are also called tractable
• Problems not in P are intractable or unsolvable
– Can be solved in reasonable time only for small
inputs
– Or, can not be solved at all.
Brinleigh 5
Cornwell
3
4
8 6
8
Avonford Fingley Donster
7
5
4
2
B 5 C
3
4
8 6
8
A F D
7
5
4 2
3 ED 2
4
8 6 AB 3
8 AE 4
A
7 F D CD 4
BC 5
5 EF 5
4
2 CF 6
AF 7
E BF 8
Sunday, April 10, 2022 CF 8 37
Kruskal’s Algorithm
Select the shortest
B 5 edge in the
C
network
3
4
8 6 ED 2
8
A F D
7
5
4
2
E
Sunday, April 10, 2022 38
Kruskal’s Algorithm
Select the next
B 5 shortest edge
C
which does not
3 create a cycle
6 4
8
8 ED 2
A
7 F D AB 3
5
4
2
E
Sunday, April 10, 2022 39
Kruskal’s Algorithm
Select the next
B 5 shortest edge
C
which does not
3 create a cycle
6 4
8
8 ED 2
A
7 F D AB 3
CD 4 (or AE 4)
5
4
2
E
Sunday, April 10, 2022 40
Kruskal’s Algorithm
Select the next
B 5 shortest edge
C
which does not
3 create a cycle
6 4
8
8 ED 2
A
7 F D AB 3
CD 4
5 AE 4
4
2
E
Sunday, April 10, 2022 41
Kruskal’s Algorithm
Select the next
B 5 shortest edge
C
which does not
3 create a cycle
6 4
8
8 ED 2
A
7 F D AB 3
CD 4
5 AE 4
4
2 BC 5 – forms a
cycle
E EF 5
Sunday, April 10, 2022 42
Kruskal’s Algorithm
All vertices have
B 5 been
C
connected.
3
4
8 6 The solution is
8
A
7 F D ED 2
AB 3
5 CD 4
4
2 AE 4
EF 5
E Total weight of
Sunday, April 10, 2022 tree: 18 43
Example of NP Class
The Travelling Salesman Problem describes a salesman
who must travel between N cities. The order in which
he does so is something he does not care about, as long
as he visits each one during his trip, and finishes where
he was at first.
not
hamiltonian
(1) B NP
• NP-Hard Problems
The following problems are NP-Hard
I. The circuit-satisfiability problem
II. Set Cover
III.Vertex Cover
• Video
clauses
Sunday, April 10, 2022 58
DeMorgan’s Laws
I. ¬(E F) ⇒ ¬(E) ¬(F)
II. ¬(E F) ⇒ ¬(E) ¬(F)
III. ¬(¬E) ⇒ E : the double negation.
x + y + (¬(¬x))(¬(¬y)) (2)
x + y + x +y (3)
Sunday, April 10, 2022 60
IndepIndependent Setnt Set
An independent set is a set of nodes with no edges
between them
This graph
contains an
independent
set of size 3
• 3-CNF is NP-Complete