A Hardness Result for Jigsaw Puzzles Michael Brand FUN with Algorithms July 13 2014 Some variations Canonic shape Non canonic shape Nonplanar shape partially assembled Apictorial ID: 233548
Download Presentation The PPT/PDF document "No Easy Puzzles:" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
No Easy Puzzles:A Hardness Result for Jigsaw Puzzles
Michael Brand
FUN with Algorithms, July 1-3, 2014Slide2
Some variations
Canonic
shape
Non-
canonic
shape
Non-planar shape
(partially assembled)
Apictorial
Canonic
puzzle =
pictoral
puzzle +
canonic
shapeSlide3
Basic metrics
n
=12
d
=4
n
=20
d
=4
n=27d
=6
n = size of the puzzle ( = # of tiles)d = degree of the puzzle ( = max # connecting to a tile)Slide4
"Tile matching" - Does the outline of the tab on tile A match the outline of the pocket on tile
B
?
Can be ignored by assuming a tile-matching Oracle."Parsimonious Testing" - Which two tiles should I try to match up next?
Can be ignored by assuming Oracle pre-calculation."Bijection
Reconstruction" - Where does tile A go in the finished puzzle?Some puzzle-solving skillsSlide5
"Bijection Reconstruction" -
Instance of
(sub-)graph isomorphism.
Polynomial without spurious matches (bounded d).
Else: NPC even on canonicals (E.+M. Demaine
)."Tile matching" - Lots and lots of literatureBest results use quite complex edge representations.Complex matching algorithms can be slow, increasing the importance of Parsimonious Testing (e.g. to find optimal trade-offs).
"Parsimonious Testing"Nothing. We address this gap in the literature.
State of the ArtSlide6
We introduce a model where Parsimonious Testing can be studied in isolation.We present it as a communication problem.
How many queries to
O
does I
need, in order to solve the puzzle?
The model
I(infinitely powerful computer, but with no knowledge of edge shapes)
O
(Oracle with perfect edge-matching abilities; can be queried)Slide7
Jigsaw puzzle = <T,
P
,
Ep, Q>
T=tiles;
P=positions; |T|=|P|=n
<P,Ep>=shape, undirected graph of degree
dQ=set of queries (that can be asked of O)Two types of queriesMatch queries
: does tile x fit to tile y?Positional queries: does tile
x fit in position p
?(We assume no spurious matches.)Pictorial puzzle: Q = all possible queries
Apictorial puzzle: Q = all match queriesSolution: bijection, π, from
T to P.Formal definitionsSlide8
Solution algorithm = decision tree
Solvable puzzle = has a solution algorithm
Communication complexity = depth of minimum-depth solution tree
More definitions
q
1
?
q2
?
q3
?
q4?
q5?
Queries from
Q
Partitioning stops when remaining solution is uniqueSlide9
The communication complexity of any set of solvable jigsaw puzzles with bounded degree is
, where
is the puzzle size.
Note that
is a trivial upper bound (ask all queries), so proof is really for
.
Loosely: no easy puzzles.
Our puzzle
def
simplifies some aspects that cannot affect this basic result. (e.g., orientation and spurious matches can only make puzzles more complex.)
Without bounded degree, can be as low as
.
Main claimSlide10
Any bipartite graph,
, with
, where the degree of each vertex is at least
has a perfect matching.
Proof: from Hall's theorem
Any set
S
of size more than
n/2 in L or
R must have n
neighbours.□
Lemma 1Slide11
Any set of bounded-degree graphs,
, has a code of distance 3 of size
.
Proof: greedy algorithm
guarantees size
per assumption that degree is bounded.
□
Lemma 2Slide12
Positional puzzle:
Q
= the set of all positional queries.
The communication complexity of positional puzzles is
, where
is the puzzle size.
Note: by definition -- solvable
Proof:We find a long path in the tree.Can be thought of as an algorithm for an "adversarial Oracle" trying to delay determination of the correct matching bijection.
Lemma 3: Positional puzzlesSlide13
Oracle strategy (positional q's)
Initialisation
1
:
.
2:
.
Function
Does x fit position
p
(
x
, p)3:
a perfect matching in
U
4
:
5
:
while
such
that
not (
and
)
do
6:
.
7:
Restrict
U
and
M
to
.
8:
end while
9
:
return
end
function
The
bijection
portion already determined.
Bipartite graph managing unmatched tiles and positions.
Queries not yet asked.
x
's neighbours in
U
.
Slide14
Strategy is well-defined
Initialisation
1
:
.
2:
.
Function
Does x fit position
p
(
x
, p)3:
a perfect matching in
U
4
:
5
:
while
such
that
not (
and
)
do
6:
.
7:
Restrict
U
and
M
to
.
8:
end while
9
:
return
end
function
Exists by Lemma 1.
Satisfied at latest when
.
Slide15
Complexity calculation
Initialisation
1
:
.
2:
.
Function
Does x fit position
p
(
x
, p)3:
a perfect matching in
U
4
:
5
:
while
such
that
not (
and
)
do
6:
.
7:
Restrict
U
and
M
to
.
8:
end while
9
:
return
end
function
By Lemma 1, while this invariant is maintained
and
L
,
R
are not empty,
U
has more than one perfect matching, so puzzle is not yet solved.Slide16
Removing even one element from
L
and
R requires at least
queries.
To empty
all elements (and solve the puzzle), one needs at least
queries.
□
Complexity calculation (
cntd
)Slide17
The main claim is different to Lemma 3 in that here both positional and match queries are allowed.We will use the Oracle strategy from Lemma 3 to
answer positional queries, but will
change the initialisation; andprovide a new function to answer match queries.
Proof of main claimSlide18
New initialisation
1:
C
← code of distance 3 and size
over
.
2:
S
← an arbitrary bijection
from T to P
.3:
.
4:
.
5:
.
Exists by Lemma 2.
By construction,
, so solving the puzzle still requires
positional queries.
The entire puzzle is predetermined (so, essentially, solved), except for the positions in
C
.Slide19
Simulate each match query by at-most one positional query.Examples:
y
matches
z because this ispart of the "solved" portion.
No two "unsolved" tilesmatch. (code distance >1.)x
doesn't match w.x matches y
iff x fits intoposition p. (Choice of
pat most unique given y because code distance>2.)Algorithm for match queriesSlide20
To solve, one still needs to empty
U
.
Match queries do not manipulate U directly; only by invoking at most one positional query.
Therefore, if any solution algorithm combining match and positional queries of depth
can empty
U, then there is also such a solution algorithm using positional queries only -- contradicting Lemma 3.
□
Completing the proofSlide21
ConclusionsNo (bounded degree) puzzle shapes are essentially much easier than any others.
No strategy is essentially much better than any other. (You don't have to start with the border!)
Open problems
All of the above is true in the worst case, against an adversarial Oracle.
What about the expected complexity? (Simulating the more realistic situation where tiles are shuffled randomly, rather than
adversarially.)Conclusions and open problemsSlide22
questions?
Thank you!