Professional Documents
Culture Documents
html
1 of 6 9/9/2007 4:56 PM
Sudoku tips: How to solve Sudoku: The mathematics of Su Doku http://theory.tifr.res.in/~sgupta/sudoku/algo.html
Wemore
can place two
4s, shown
in black in the picture
on the left. This
requires slice and dice
exactly as before.
Another example: we
can place a 1 by slice
and dice as shown in
the picture on the
right.
2 of 6 9/9/2007 4:56 PM
Sudoku tips: How to solve Sudoku: The mathematics of Su Doku http://theory.tifr.res.in/~sgupta/sudoku/algo.html
T o get to the first step of the bootstrap from the last picture shown above, we
need to slice and dice to place an 8 in the center bottom cell. You must be an expert
at this method by now, so I leave that in your capable hands.
Thethefirst element of
bootstrap is to
place 8s in the middle
row of cells. The
picture on the left
shows where the 8s
must be placed in the
middle left cell. The
picture on the right
shows the placement
in the central cell.
3 of 6 9/9/2007 4:56 PM
Sudoku tips: How to solve Sudoku: The mathematics of Su Doku http://theory.tifr.res.in/~sgupta/sudoku/algo.html
Thegame.
worst is over. We are now truly into the end
First complete cell C entirely by the "loner"
trick: filling 6, 5, 3 and 7 in that order. Next complete
the cell F. Then finish the 7th column, place the 5 in
the cell D, and complete that row, in order to get the
picture on the left. We are more than half done. From
now on common sense prevails: fill things in one by
one. Don't panic, there are no sharks circling the
boat. No swordfish either.
Thealthough
last rule, I promise. And it is hardly one,
you could call it the "hidden loner" rule.
The only reason one should give it a name is that it
fixes this very useful method in one's mind. So here
is the example: In the 6th row there's more than one
choice in each square. However there is only one
place where the 5 can go (it is excluded from the
squares with X's in them). So there is a loner hidden
in this row: hence the name. I stop here, but you can
go on to solve a fiendish puzzle by the simplest tricks
exclusively.
Not so fiendish?
4 of 6 9/9/2007 4:56 PM
Sudoku tips: How to solve Sudoku: The mathematics of Su Doku http://theory.tifr.res.in/~sgupta/sudoku/algo.html
Theclues)
minimum Su Doku shown alongside (only 17
requires only two tricks to solve: identifying
hidden loners and simple instances of locked
candidates. The key is to apply them over and over
again: to each cell, row and column. The application
of constraints repeatedly in order to reduce the space
of possibilities is called constraint programming in
computer science. "Pencilling in" all possible values
allowed in a square, and then keeping the pencil
marks updated is part of constraint programming.
This point has been made by many people, and
explored systematically by Helmut Simonis.
This is where much of the counting appears. Before clues are entered into a M×M
M2
Su Doku puzzle, and the constraints are applied, there are M states of the
grid. This is larger than any fixed power of M (this is said to be faster than any
polynomial in M). If depth-first enumeration were the only way of counting the
number of possible Su Dokus, then this would imply that counting Su Doku is a hard
problem. Application of constraints without clues is the counting problem of Su
Doku. As clues are put in, and the constraints applied, the number of possible
states reduces. The minimum problem is to find the minimum number of clues
which reduces the allowed states to one. The maximum problem is analogous.
Onejustsure fire way of solving any Su Doku puzzle is to forget all these tricks and
blindly do a trial-and-error search, called a depth-first search in computer
science. When programmed, even pretty sloppily, this can give a solution in a
couple of seconds. If we use this method on M×M Super Doku, then the expected
5 of 6 9/9/2007 4:56 PM
Sudoku tips: How to solve Sudoku: The mathematics of Su Doku http://theory.tifr.res.in/~sgupta/sudoku/algo.html
r
un time of this program on the trickiest puzzles (called worst-case in computer
science) would grow faster than any fixed power of M, but (of course) it is
guaranteed to solve the puzzle. If trial-and-error were the only algorithm to solve
any Su Doku puzzle whatsoever, and one were able to show that the state space of
a puzzle grows faster than a fixed power of M, then this would prove that Su Doku is
an NP problem.
H elmut Simonis has results which might indicate that trial-and-error is never
needed, and a small bag of tricks with hyper arc consistency always answers the
Su Doku question. However, one needs to ask how many times the consistency
check has to be applied to solve the worst-case problem, and how fast this grows
with M, in order to decide whether constraint programming simplifies the solution.
From this formal point of view, one can see the debate raging currently on Michael
Mepham's web site and other discussion boards on Su Doku as an argument
between the search enthusiasts and the constraint programming wallahs: with
Mepham slowly giving ground in his defence of search. But does the debate just
boil down to choosing which algorithm to use? Yes, if the Su Doku problem is easy
(ie, in P) and constraint programming solves it faster. However, if Su Doku is hard,
then there is a little more to it.
Inbemany instances of NP complete problems, the average run time of programs can
substantially less than the worst-case. Gomes and Selman conjecture that this
is due to the existence of "backdoors", ie, small sets of tricks which solve these
average problems. Here human intuition (called heuristics in computer science) can
help to identify the backdoors and often crack the nut faster than the sledge
hammer of systematic algorithms. These I call "satisfactory puzzles". One of the
open problems for Su Doku is to define precisely the nature of such backdoors, and
the classes of problems which contain them.
© Sourendu Gupta. Mail me if you want to reproduce any part of this page. My
mailing address is a simple (satisfactory) puzzle for you to solve. Created on 13
October, 2005. Last modified on 19 June, 2006.
6 of 6 9/9/2007 4:56 PM