SAT problem SAT Find Boolean satisfiability problem the
SAT problem ► SAT ► Find – Boolean satisfiability problem the assignment to each binary variable so the expression evaluates to TRUE ► Exhaustive search – EXHAUSTIVE!!! ► Transform the expression to CNF (Conjunctive Normal Form)
SAT problem Example 4 variables – 24=16 combinations to check 100 variables – 2100 ≈ 1030 combinations to check If we check 1 million combinations per second, since the big bang (10 billion years ago) we would have checked less than 1% of all combinations
SAT problem ► Another problem is that after each evaluation we get only 0 (FALSE) or 1 (TRUE), and the result of the evaluation doesn’t tell us what should we do ► We don’t know how far we are from the solution
TSP – Traveling Salesman Problem The traveling salesman must visit each town exactly ones and return home covering theminimum distance. Textbook examples allow connections between all cities, real world problem are different.
TSP Symmetric dist(i, j) = dist(j, i) Assymmetric dist(i, j) ≠ dist(j, i)
TSP ► Size of the search space: permutations of n (=20) cities Same tours 2 – … – 5 – 6 – 15 – 3 – 11 – 19 – 17 – 2 – … – 6 – 15 Symmetric TSP: reverse tours are the same
TSP tour can be represented in 2 n different ways (symmetric TSP), and there are n! ways to permute n numbers ► Every ► |S|=n!/(2 n)=(n-1)!/2 ► For n>6 there are more possible solutions to the TSP than to SAT.
TSP vs. SAT n SAT TSP 3 8 1 4 16 3 5 32 12 6 64 60 7 128 360 8 256 2520 … … … n=10 S≈181000 n=20 S ≈1016 n=50 S ≈1062 “Only” 1021 liters of water on the planet Better evaluation for TSP than for SAT!
Problem solving ► In every problem we must specify: 1. Representation 2. Objective (goal) 3. Evaluation function
Representation of SAT ►n variable that are logical bits, we represent a candidate solution as a binary string of length n. ► Each element in the string corresponds to one variable of the problem. ► The size of the search space is 2 n.
Objective ► SAT: find the vector of bits such that the Boolean statement is satisfied ► TSP: minimize the total distance traveled by the salesman subject to constraint of visiting each city exactly once and returning ti the starting city. min ∑ dist(x, y)
Evaluation function ► The evaluation function assigns a number to each candidate solution, indicating its quality. ► TSP: map each tour to its corresponding total distance. ► When choosing the evaluation function it must have the best value when the solution is found.
Evaluation function ► SAT: every approximate solution evaluates to FALSE and this doesn’t give us any useful information on how to improve one candidate solution to other, or how to search for better alternative.
Tiling 64 squares = 32*2 62 squares = 31*2
Tiling 64 squares = 32*2 62 squares = 31*2
Matches and triangles ► Given 6 matches construct 4 equilateral triangles where the length of each side is equal to the length of a match. ► 2 triangles, 5 matches (1 match remaining): We are searching in the wrong search space!!!
Matches and triangles ► Given 6 matches construct 4 equilateral triangles where the length of each side is equal to the length of a match. ► 2 triangles, 5 matches (1 match remaining): We are searching in the wrong search space!!! Solution!
- Slides: 17