the minimum number of givens in a fair sudoku puzzle (is 17!)

24
The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!) Joshua Cooper USC Department of Mathematics

Upload: kasi

Post on 21-Jan-2016

46 views

Category:

Documents


4 download

DESCRIPTION

The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!). Joshua Cooper USC Department of Mathematics. 1. 3. 7. 8. 9. 7. 4. 8. 5. 9. 2. 8. 1. 6. 6. 8. 7. 1. 2. 8. 4. 7. 1. 8. 1. 3. 7. 5. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

Joshua CooperUSC Department of Mathematics

Page 2: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

Rules: Place the numbers 1 through 9 in the 81 boxes, but do not let any numberappear twice in any row, column, or 33 “box”.

You start with a subset of the cells labeled, and try to finish it.

1 3 7 8

7 4

8 5

9 2 8 1 6

6 8 7 1 2

8 4

7 1

8 1 3 7 5

96 5 4 2

8 3 2 6 1 5 9

9 2 4 7 6 1 3

4 7 5 3

3 1 2 9 4 6 5 8 7

5 3 9 4

5 9 6 1 3 7 2

2 3 6 9 5 8 4

4 2 9 6

Page 3: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

A Sudoku puzzle designer has two main tasks:

1. Come up with a board to use as the solution state.

2. Designate some subset of the board’s squares as the initially exposed numbers (“givens”).

For example:

1 3 7 87 4

8 59 2 8 1 6

6 8 7 1 28 4

7 18 1 3 7 5

6 5 4 28 3 2 6 1 5 9

9 2 4 7 6 1 34 7 5 33 1 2 9 4 6 5 8 7

5 3 9 45 9 6 1 3 7 22 3 6 9 5 8 4

4 2 9 6

9 1 3 7 87 4

8 59 2 8 1 6

6 8 7 1 28 4

7 18 1 3 7 5

9

We’re going to focus on task #1: How to choose a “fair” Sudoku board?

BOARD PUZZLE

CELL

COLUMN

ROW

BOX

STACK

BAND

GIVEN

Page 4: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

For a Sudoku puzzle, i.e., a set of givens, to be “fair”, it must have two properties:

1. It has a solution. (Solvability)

2. There is only one solution. (Uniqueness)

Question: What is the fewest number of givens in a fair puzzle?

Possible solution (“Brute Force”):

1. Enumerate all possible sets of givens.

2. Check each one to see if it is solvable.

3. Check the solvable ones to see if they are unique.

4. Count up the number of givens in the smallest uniquely solvable puzzle, and output the minimum such number.

Page 5: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

Why Brute Force Is Impractical:

1. Enumerate all possible sets of givens.

With 81 cells, there are 281 ≈ 2.4 ∙ 1024 sets of cells one could fill in.

“81 choose 3” = the number of ways to choose 3 objects from a collection of 81

.1080123

798081

!3!78

!81

Actually, the situation is even worse, because we have 9 options for the contents ofeach cell. That means a total number

of possible sets of givens.

812

813

8180

81811 + 9 ∙ 81 + 92 ∙ ( ) + 93 ∙ ( ) + … + 980 ∙ ( ) + 981 ∙ ( )

Page 6: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

Why Brute Force Is Impractical:

1. Enumerate all possible sets of givens.

With 81 cells, there are 281 ≈ 2.4 ∙ 1024 sets of cells one could fill in.

Actually, the situation is even worse, because we have 9 options for the contents ofeach cell. That means a total number

of possible sets of givens.

812

813

8180

8181

“N choose K” = the number of ways to choose K objects from a collection of N

.BIG!)!(

!

KKN

N

1 + 9 ∙ 81 + 92 ∙ ( ) + 93 ∙ ( ) + … + 980 ∙ ( ) + 981 ∙ ( )

Page 7: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

Why Brute Force Is Impractical:

1. Enumerate all possible sets of givens…

With 81 cells, there are 281 ≈ 2.4 ∙ 1024 sets of cells one could fill in.

Actually, the situation is much worse, because we have 9 options for the contents ofeach cell. That means a total number

of possible sets of givens.

812

813

8180

8181

By the Binomial Theorem,

,10)91(81

9 818181

0

j

j

j

which is approximately the number of atoms in the observable universe.

1 + 9 ∙ 81 + 92 ∙ ( ) + 93 ∙ ( ) + … + 980 ∙ ( ) + 981 ∙ ( )

Page 8: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

Let’s be a little smarter about this…

1. Enumerate all sets of 81 givens, and if a uniquely satisfiable puzzle is found, enumerate all sets of 80 givens, and if a uniquely satisfiable puzzle is found, enumerate all sets of 79 givens…

In fact, we can start much lower than 81, since there are many uniquely satisfiablepuzzles known with fewer than 81 givens.

Indeed, there are uniquely satisfiable puzzles known which have only 17 givens.

4

5 4 7

1 9

8

1

2

8 3

3 4 25 1

6

Gordon Royle has compiled a list of 49151 (!) inequivalent ones at:

http://mapleta.maths.uwa.edu.au/~gordon/sudokumin.php

Page 9: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

What does it mean for two Sudoku boards/puzzles to be equivalent?

1. Permuting the rows and columns of each band/stack (X 3!6)

I

II

III

A B C

2. Permuting bands I, II, and III, and

and stacks A, B, and C (X 3!2)

3. Permuting the numbers/colors (X 9!)

Two boards are considered equivalent if it is possible to transform one into the otherby a sequence of operations of the form:

This generates a group of 3,359,232different possible operations.

We’ll call this the “Sudoku group.”

Page 10: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

So, start with 16 givens:

1. Enumerate all sets of 16 givens…

How many such sets are there?

916 ∙ ( ) ≈ 6.22 ∙ 10318116

It would be silly to look at all of these, though:

1. We can rule out anything that has two of the same symbol in any column, row, or box.

2. Once we examine one, we don’t have to look at all the ones equivalent to it.

3.64 × 1023

Approximate total number of inequivalent configurations of 16 “non-conflicting” givens:

Still way too big.

Even if we could enumerate all of these, and even if we knew how to generate a list ofone representative of each equivalence class (= orbit under the Sudoku group)…

2. Check each one to see if it is solvable.3. Check the solvable ones to see if they are unique. } Use backtracking.

Page 11: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

NEWS FLASH!!!

January 1, 2012: McGuire, Tugemann, Civario, University College Dublin

There is no 16-Clue Sudoku: Solving the Sudoku Minimum Number of Clues Problem

Posted on the arXiv, so it has not been published (i.e., vetted by a referee).

Nonetheless, it looks legit.

Q: How the *$?&!* did they do that!?

A: Some clever mathematics, some very clever programming, and a RIDICULOUS amount of computing power:

7.1 million core hours on an SGI Altix ICE 8200EX cluster with 320 compute nodes, each of which has two Intel (Westmere) Xeon E5650

hex-core processors and 24GB of RAM = approx 1 year real time

Page 12: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

The general strategy:

1. Construct a catalogue of all 5,472,730,538 inequivalent boards.

Done by Glenn Fowler, AT&T labs. Full enumeration, with a veryclever and specialized compression algorithm.

Uncompressed data size: 418 GB.

Compressed data size: 6 GB. (That’s 8.77 bits/board!)

2. Search each board for sub-puzzles with 16 givens, and check each one to see if it can be uniquely completed to a valid Sudoku board.

BIG PROBLEM: Earthon began life

since seconds ofnumber 104.3

16

81 16

So, McGuire et al were smarter about which sets of cells they looked at.

Page 13: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

Observation:

9 3 7 8 5 6 2 4 15 6 2 1 9 4 3 8 74 8 1 2 7 3 5 6 98 2 3 6 4 7 9 1 56 1 5 9 3 2 4 7 87 4 9 5 8 1 6 2 33 7 8 4 6 9 1 5 21 9 6 7 2 5 8 3 42 5 4 3 1 8 7 9 6

Every fair puzzle must containat least one of the red numbers.

Call such a set of cells“unavoidable”.

Page 14: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

Observation:

9 3 7 8 5 6 2 4 15 6 2 1 9 4 3 8 74 8 1 2 7 3 5 6 98 2 3 6 4 7 9 1 56 1 5 9 3 2 4 7 87 4 9 5 8 1 6 2 33 7 8 4 6 9 1 5 21 9 6 7 2 5 8 3 42 5 4 3 1 8 7 9 6

Every fair puzzle must containat least one of the red numbers.

Call such a set of cells“unavoidable”.

Smarter strategy for searching for16 cell puzzles:

1. For each completed board, find lots of unavoidable sets.

2. Enumerate all the sets of 16 cells that hit each unavoidable set at least once.

3. Check each set of 16 cells to see if it is a fair puzzle.

Page 15: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

1. For each completed board, find lots of unavoidable sets.

Strategy: Ed Russell compiled a list of 525 “blueprints” (which includes allof them on 11 or fewer cells).

Apply the Sudoku group to these blueprints to obtain a large collection ofthem, and then compare to each puzzle in turn.

Example blueprint:

1 34

3 4

2 43 1 2

2 1

Page 16: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

2. Enumerate all the sets of 16 cells that hit each unavoidable set at least once.

This is the so-called “hitting set” problem, well known to be NP-hard.

Definition. Given a collection of subsets of clues (the unavoidable sets), a hitting set (or transversal) for this collection is a set of clues that intersects every one of the subsets.

Algorithm:

1.At each step, find the smallest unavoidable set that does not contain any of the clues picked so far, and then try each element of this unavoidable set as the next clue. 2.Repeat until 16 clues have been chosen. 3.If the collection of unavoidable sets is exhausted before we get to the 16th clue, simply add the remaining clues needed in all possible ways.

Small but crucial improvement: whenever we add a clue to the hitting set from an unavoidable set, we consider all smaller clues from that unavoidable set as dead, i.e., we exclude these smaller clues from the search (in the respective branch of the search tree only).

Page 17: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

3. Check each set of 16 cells to see if it is a fair puzzle.

McGuire et al used an open-source Sudoku solver written by Brian Turner, available online. This solver can check around 50,000 16-clue puzzles per second for a unique completion.

One “little” issue: is this a proof ?

It’s not human-checkable: the computation is too big.

As long as our understanding of physics is sufficientlyaccurate to completely predict the behavior of a processorunder the given instruction set, the computation is to bebelieved…

… unless there is a bug in their code…

… or there is a bug in the kernel of the OS running the code…

… or a cosmic rays streams in from outer space and knocks an electron out of place at just the right (wrong?) moment…

Page 18: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

… or a radioactive atom in the chip’s substrate material decays, tossing off an alpha particle…… or random noise is caused by transient EMF fields, perhaps from inductive or capacitative “crosstalk”…

… or our understanding of physics isn’t quite good enough…

Tezzaron Semiconductor, 2004 whitepaper “Soft Errors in Electronic Memory”estimates that modern memory is subject to 1000 to 5000 FIT (bit flip per billionhours of use) per Mbit of memory.

What a headache!

Are these issues really worthworrying about, or are they sorare that they are not aproblem?

A yearlong computation probably has lots of these errors, then!

Page 19: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

What to do!?Define a graph Sud on the set of cells with a complete subgraph in each row, column, and box.

Definition. A graph G is said to be k-colorable if it is possible to assign k colors to thevertices in such a way that no edge has both its vertices colored the same.

Definition. The chromatic number χ(G) of a graph G is the smallest integer k so

that G is k-colorable.

Page 20: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

Definition. For a graph G and a proper vertex coloring c with exactly χ(G) colors,define a “determining set” to be a set of vertices so that the coloring, restricted to thosevertices, can be completed to a bona fide proper vertex coloring of the graph in exactlyone way.

Definition. For a graph G and a proper vertex coloring c with exactly χ(G) colors,define a “critical set” to be a determining set so that removing any vertex makes theset non-determining.

Definition. For a graph G and a proper vertex coloring c with exactly χ(G) colors,

define scs(G;c) to be the size of the smallest critical set for G and c, and lcs(G;c)to be the size of the largest critical set.

Definition. For a graph G, define

)lcs(minlcs G;cGc

)scs(maxscs G;cGc

)scs(minscs G;cGc

)lcs(maxlcs G;cGc

Page 21: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

Theorem (McGuire et al ‘12).

.17scs Sud

Perhaps by studying these parameters, we can eventually construct a(human-readable) mathematical proof of this result.

For example…

Theorem (C., Kirkpatrick ’12+). For n even,

.1lcslcsscsscs nnnn CCCC

Theorem (C., Kirkpatrick ’12+). For n odd,

2

1scs

nCn 1lcs nCn

2scs nCn

)4(mod3 if

2

3

)4(mod1 if2

1

lcsn

n

nn

Cn

Page 22: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

These parameters (by other names) have been studied before in other contexts, particularly for Latin squares.

Definition. A Latin square of order n is an n X n matrix whose cells are filled with

the numbers 1, …, n, so that each column and row contains exactly one of eachsymbol.

Theorem (Cavenagh ‘07). scs(Kn □ Kn) ≥ cn (log n)1/3.

Definition. The Latin square graph of order n is the Cartesian product

Kn □ Kn

of two complete graphs on n vertices, i.e., (a, b) ∈ [n] X [n] is adjacent to

(c, d) ∈ [n] X [n] iff a = b or c = d.

NB. This is the first superlinear lower bound! The proof uses very special propertiesof Latin squares. More generalizable proof?

Theorem (Cooper, Donovan, Seberry ‘91). scs(Kn □ Kn) ≤ ⌊n2/4⌋.

Page 23: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

Theorem (Cavenagh, Donovan, Abdollah ‘05). scs(Kn □ Kn) ≥ ⌊n2/4⌋ when

n is odd.

Theorem (Gower, ‘00). lcs(Kn □ Kn) ≥ n2(1-o(1)).

Theorem (Dejter, Horak, ‘07). lcs(Kn □ Kn) ≤ n2 – 7n / 2.

Theorem (Ghandehari, Hatami, Mahmoodian, ‘05).

2/323/52

2)(scs))1(( nnLnoen

Page 24: The Minimum Number of Givens in a Fair Sudoku Puzzle (is 17!)

Thanks!

P.S. There are as many open problems about this as there are graphs. If you are interested in doing some research, contact me at [email protected].