190 likes | 385 Vues
Spiral Galaxies Puzzles are NP-complete. Erich Friedman Stetson University October 2, 2002. Spiral Galaxies Puzzles. puzzles consist of grid of squares and some circles .
E N D
Spiral Galaxies Puzzlesare NP-complete Erich Friedman Stetson University October 2, 2002
Spiral Galaxies Puzzles • puzzles consist of grid of squares and some circles. • the object is to divide a puzzle into connected groups of squaresthat contain one circle, which must be a center of rotational symmetry.
P and NP • P is the set of all yes/no problems which are decidable in polynomial time. • NP is the set of all yes/no problems in which a “proof” for a yes answer can be checked in polynomial time. P is a subset of NP. The question whether P=NP is one of the most important open questions in computer science.
NP-Completeness A problem is NP-complete if: • it is in NP, and • the existence of a polynomial time algorithm to solve it implies the existence of a polynomial time algorithm for all problems in NP. NP-complete problems are: • easy enough to check in polynomial time • the hardest such problems
Examples of NP-Completeness Examples of NP-complete problems are: • 3-Colorability: Can the vertices of a graph G be colored with 3 colors so that every pair of adjacent vertices has different colors? • Hamiltonicity: Does a graph G have a circuit that visits each vertex exactly once? • Bin Packing: Can we divide N numbers in K sets so that each set has sum less than S? • Satisfiability: Are there inputs to a Boolean circuit with AND/OR/NOT gates that make the outputs TRUE?
Spiral Galaxies Puzzles are NP-complete • The Main Result of this talk is: The question of whether or not a given Spiral Galaxies puzzle has a solution is NP-complete. • To prove this, we will build arbitrary Boolean circuits in the Spiral Galaxies universe. • "wires" carry truth values • "junctions" in wires simulate logical gates • Since Satisfiability is NP-complete, Spiral Galaxies puzzles are also NP-complete.
The Construction We need: • wires • variables that can have either truth value • way to end a wire that forces it to be TRUE • NOT gate • AND gate • OR gate • way to split the signal in a wire • way to allow wires to cross
Wires and Signals • wires arerectangles of height 2with a circle every 3 units. • a wire carries the value TRUE if the solution involves 3x2 rectangles and FALSE if the solution involves alternating 5x2 and 1x2 rectangles. A TRUE signal a FALSE signal
Variables • variables are configurations with two local solutions. A TRUE variable a FALSE variable
Ending Wires • to force a TRUE or FALSE signal in a wire, we can end the wire at an appropriate point. forcing a TRUE signal forcing a FALSE signal
NOT Gate • the NOT gate is a wire that contains a pair of circles that are only 2 units away.
Moving Wires • to shift a wire one unit left, we use three consecutive circles each a distance of 2.5 units from the previous one. • to shift a wire one unit up, we use three consecutive circles each raised .5 units from the previous one.
Filling in the Holes • to make the puzzle rectangular, we put a circle in every grid square that is not a part of the circuit.
Summary • For any given circuit, we can find a Spiral Galaxies puzzle that can be solved if and only if there is a set of inputs to the circuit that make the output TRUE. • This Satisfiability problem for circuits is known to be NP-complete. • The mapping we gave is polynomial. • Therefore whether or not a given Spiral Galaxies puzzle has a solution is also NP-complete.
References • [1] T. C. Biedl, E. D. Demaine, M. L. Demaine, R. Fleischer, L. Jacobsen, and J. I. Munro, "The Complexity of Clickomania". preprint. • [2] J. Culberson, "Sokoban is PSPACE complete." Proc. Internet Conf. Fun with Algorithms (1998), N. S. E. Lodi, L. Pagli, Ed., Carelton Scientific, 65-76. • [3] E. D. Demaine and M. Hoffman, "Pushing blocks is NP-complete for non-crossing solution paths". Proc. 13th Canad. Conf. Comput. Geom. (2001), 65-68. • [4] E. Friedman, "Corral Puzzles are NP-complete". preprint. • [5] E. Friedman, "Cubic is NP-complete". Proc. 2001 Fl. Sectional MAA meeting, David Kerr ,Ed. • [6] E. Friedman, ”Pearl Puzzles are NP-complete". preprint. • [7] M.R. Garey and D.S. Johnson, Computers and Intractibility: A Guide to the Theory of NP-Completeness. W.H. Freeman, 1979. • [8] R. Kaye, "Minesweeper is NP-complete". Mathematical Intelligencer, 22 (2000) 9-15. • [9] Nikoli, 91 (2000). • [10] D. Ratner and M. Warmuth, "Finding a shortest solution for the n x n extension of the 15-puzzle is intractable". J. Symb. Comp.10 (1990) 111-137. • [11] S. Takahiro, "The Complexities of Puzzles, Cross Sum, and Their ASPs". preprint. • [12] Y. Takayuki, "On the NP-completeness of the Slither Link Puzzle". IPSJ SIGNotes Algorithms (2000). • [13] N. Ueda and T. Nagao, "NP-completeness Results for Nonogram via Parsimonious Reductions". preprint.