Pancakes Puzzles and Polynomials Cracking the Cracker Barrel
Pancakes, Puzzles, and Polynomials: Cracking the Cracker Barrel Game Christopher Frost Michael Peck
The Cracker Barrel Game 2
The Cracker Barrel Problem (CB) Given an arbitrarily sized board with some initial configuration of pegs, is there a sequence of jumps such that the board will be left with one remaining peg? 3
How Hard Is It To Solve The Cracker Barrel Game? n Straightforward way of solving the peg board puzzle: n Try all possible ways to move a peg n Look at all possible ways of moving a peg for each of the above moves n . . . n n n Until find a sequence of moves with one peg left or run out of possible moves (no solution) How long will this take to solve? Is this the fastest way? 4
Complexity n Measuring complexity: n n How does the time needed to solve a problem grow as the size of the input to the problem grows? Example: linear-time n If the size of the input doubles, the time needed to solve doubles. 5
Complexity: A Look at How Growth Rates Compare 6
Complexity Classes: The Big Three P NP NP-C or n P – Polynomial n n NP – Nondeterministic Polynomial n n Problems that can be solved in nk time P=NP NP-C Problems that can be verified in nk time NP-Complete n Problems that are at least as hard as all other problems in NP Does P=NP? Are all the problems in NP also in P? The biggest unanswered question in computer science. 7
Example NP-Complete Problems n Protein Folding n Traveling Salesperson n Map coloring n Cracker Barrel? 8
Project Goal Is CB (the Cracker Barrel problem) NP-Complete? 9
Proving NP-Completeness n Must show two conditions: Problem belongs to NP n Is at least as hard as any problem in NP n 10
Example NP-Complete Problem: 3 -SAT Expression Clauses Terms (x 1 x 2 x 4) ( x 1 x 2 x 3) n Is there an assignment of values to these terms that makes the above expression true? n n Yes! n One solution: If x 1 = true and x 3 = true, the above expression is true. 11
Proving NP-Completeness: Solving any problem in NP using CB n Reduction: Showing that a known NPcomplete problem can be solved using a solver for CB. 3 -SAT Solver Input to 3 -SAT Solver 3 -SAT to CB Transformer CB Solver Answer 12
3 -SAT to CB Transformer n n Represent a logical expression on a peg board. (x 1 x 2 x 4) ( x 1 x 2 x 3) x 1 C 1 x 2 x 4 x 1 C 2 x 3 x 1 x 2 x 3 x 4 13
3 -SAT to CB Transformer: Inside The Mysterious Blue Tile Goal: Allow green peg across iff yellow has come down. The Non-transitive Peg Hierarchy of Power 1. > 2. = > x 1 > a > b: a can jump b, but b can’t jump a. 14
3 -SAT to CB Transformer 19
3 -SAT to CB Transformer: Inside The Green Tile Goal: Reduce the number of green pegs to one iff every clause had one or more pegs cross the board. The Non-transitive Peg Hierarchy of Power 1. > 2. = > > a > b: a can jump b, but b can’t jump a. x 1 C 1 x 2 x 4 20
Progress and Implications n Progress: n n n Our best known CB solver takes exponential time Proved a variation of CB is NP-Complete Implications: n Is it possible to create a CB solver that runs in polynomial time? n n If so, P=NP (Given that CB is NP-complete) If not, P≠NP 21
Questions? 22
- Slides: 18