erich friedman stetson university october 2, 2002 spiral galaxies puzzles are np-complete

19
Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

Upload: hayden-vaughan

Post on 26-Mar-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

Erich FriedmanStetson UniversityOctober 2, 2002

Spiral Galaxies Puzzlesare NP-complete

Page 2: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

Spiral Galaxies Puzzles• puzzles consist of grid of squares and some circles.• the object is to divide a puzzle into connected groups

of squares that contain one circle, which must be a center of rotational symmetry.

Page 3: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

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.

Page 4: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

NP-CompletenessA 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

Page 5: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

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?

Page 6: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

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.

Page 7: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are 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

Page 8: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

Wires and Signals

• wires are rectangles of height 2 with 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

Page 9: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

Variables

• variables are configurations with two local solutions.

A TRUE variable a FALSE variable

Page 10: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

Ending Wires

forcing a TRUE signal forcing a FALSE signal

• to force a TRUE or FALSE signal in a wire, we can end the wire at an appropriate point.

Page 11: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

NOT Gate• the NOT gate is a wire that contains a pair of

circles that are only 2 units away.

Page 12: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

AND Gate

Page 13: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

OR Gate

Page 14: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

Letting Wires Cross

Page 15: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

Splitting a Signal

Page 16: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

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.

Page 17: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

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.

Page 18: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are NP-complete

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.

Page 19: Erich Friedman Stetson University October 2, 2002 Spiral Galaxies Puzzles are 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.