minesweeper is np-complete notes by melissa gymrek based on a paper by richard kayes 2000
Post on 19-Dec-2015
236 views
TRANSCRIPT
![Page 1: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/1.jpg)
Minesweeper is NP-Complete
Notes by Melissa GymrekBased on a paper by Richard Kayes 2000
![Page 2: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/2.jpg)
Minesweeper
Reducing 3SAT to generalized Minesweeper
Reducing cSAT to well-know version of Minesweeper
![Page 3: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/3.jpg)
MINESWEEPER: { G, ξ |G is a graph and ξ is a partial integer labeling of G, and G can be filled
with mines in such a way that any node v labeled m has exactly m neighboring nodes containing mines.}
Deciding if a graph is in the MINESWEEPER language is NP-complete:- Polynomial time verification- Reduce from 3SAT in polynomial time
General Minesweeper
![Page 4: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/4.jpg)
For each node v labeled m:
Check that exactly m neighbors contain mines
O(E) time – clearly polynomial
Polynomial Time Verification
![Page 5: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/5.jpg)
Reduce from 3SAT
3SAT instance w MINESW instance Zf(w)
Function f converts a 3SAT instance to a MINESW instance in polynomial time
Z is satisfiable iff w is satisfiable
![Page 6: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/6.jpg)
Boolean 3CNF formula: (A V B V C) ^ (~A V D V ~C) ^ …
N variables (A, B, C, D) in this instanceM clauses (here 2 clauses are shown)
Question: Is this boolean formula satisfiable?
3SAT Review
![Page 7: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/7.jpg)
3SAT → MINESWEEPER
0 0
1
Make a gadget for each variable
xi ~x
i
![Page 8: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/8.jpg)
3SAT → MINESWEEPER
N
N00 0... N-1 “satellite” nodes
Make a gadget for each clause
0 00 0 00 0 00
1 1 1
For clause (A V B V ~C)
A BA C
Connect to variablegadgets
![Page 9: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/9.jpg)
Conversion took polynomial time:
1 gadget for each of the N vars = O(N)
1 gadget for each of M clauses = O(MN)
Total O(N(M+1)) time
3SAT → MINESWEEPER
![Page 10: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/10.jpg)
MINESWEEPER Problem: Given a rectangular grid partially marked with numbers and/or mines, some squares being left blank, determine whether there is some pattern of mines in the blank squares giving rise to the numbers seen.
Deciding if a graph is in the MINESWEEPER language is NP-complete:- Polynomial time verification- Reduce from cSAT in polynomial time
Minesweeper as we know it
![Page 11: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/11.jpg)
Wire
Either all the x's or all the x''s are mines. If it is the x's, we call it “true”, if the x''s, we call it “false”
http://www.claymath.org/Popular_Lectures/Minesweeper/msweep-fig3.jpg
![Page 12: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/12.jpg)
Manipulating Wires
Minesweeper is NP-Complete, Kayes
![Page 13: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/13.jpg)
Manipulating Wires
Minesweeper is NP-Complete, Kayes
![Page 14: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/14.jpg)
NOT gate
Inverts the sign of a wire
http://www.claymath.org/Popular_Lectures/Minesweeper/msweep-fig3.jpg
![Page 15: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/15.jpg)
We can now manipulate/invert wires
Cross wires? First make planar XOR, then use XOR and three way splitter to cross wires
We have NOT, and AND, universal!
More gates
![Page 16: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/16.jpg)
More gates
Minesweeper is NP-Complete, Kayes
![Page 17: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/17.jpg)
AND gate
Minesweeper is NP-Complete, Kayes
![Page 18: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/18.jpg)
(A nand A) nand (B nand B) = A v B
(A nand B) nand (A nand B) = A ^ B
(A nand A) = ~A
NAND is universal!
![Page 19: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/19.jpg)
Tetris is NP-complete
Ron Breukelaar, Erik Demaine, Susan Hohenberger,
Hendrik Jan Hoogeboom, Walter Kosters, David Liben-Nowell
published 2004
![Page 20: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/20.jpg)
![Page 21: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/21.jpg)
3-Partition• Given 3s integers a1, a2, …, a3s, can you partition into s triples with the same sum?– Know the sum must be T = ∑ai / s
• This problem is strongly NP-complete:NP-complete even if ai numbers are sO(1)
…?
T
s triples
![Page 22: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/22.jpg)
Initial Board
s columns(one per sum)
≈ T notches(target sum)
T lock
bane
(it is possible toactually get here)
![Page 23: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/23.jpg)
Piece Sequence
• For each input ai:
(ai reps)
![Page 24: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/24.jpg)
Failure to Launch
![Page 25: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/25.jpg)
Forced Moves
![Page 26: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/26.jpg)
FinalePieces
![Page 27: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/27.jpg)
FinalePieces
![Page 28: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/28.jpg)
FinalePieces
![Page 29: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/29.jpg)
FinalePieces
![Page 30: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/30.jpg)
FinalePieces
![Page 31: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/31.jpg)
FinalePieces
![Page 32: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/32.jpg)
Summary
• If there’s a 3-partition, can win Tetris:Get tons of lines, Tetrises, live forever, etc.
• If there’s no 3-partition, must lose Tetris:Die, no lines, no Tetrises, etc.
![Page 33: Minesweeper is NP-Complete Notes by Melissa Gymrek Based on a paper by Richard Kayes 2000](https://reader036.vdocuments.site/reader036/viewer/2022062407/56649d3f5503460f94a18d4c/html5/thumbnails/33.jpg)
Open Problems
• What if the initial board is empty?• What about Tetris with O(1) columns?• What about Tetris with O(1) rows?• What about restricted piece sets (e.g. just )?• What if every move drops from high up(no last-minute slides)?
• Is two-player Tetris PSPACE-complete?• What can we say about online (regular) Tetris?