Earlier quoted context omitted.
solving without trial and error at all.
If you do the constraint propagation right, the number of trials and errors will be very small (and it will be only one trial and no errors for the easy ones). I'd be very interested to see what an algorithm that solves any valid sudoku puzzle looks like. (apart from pathologic solutions like querying a database of all valid 9x9 sudoku combinations).
Sudoku Solving
21–30 of 55 posts
Re: Sudoku Solving
#22Earlier quoted context omitted.
That strikes me as extremely unlikely . I think the complexity class of Sudoko is NP-Complete (a quick google confirms it's not exactly NP but very close: http://11011110.livejournal.com/23221.html?thread=19381 -- complexity is the same as solving SAT problems which have only one unique solution)
Sudoku are designed so that there is always a correct move that does not require guesswork.
They're typically designed to be unambiguous (only one correct solution), so in that sense there is always a 'correct' move.
However, finding that correct move is exactly as hard, in the computational sense, as finding the solution to the entire puzzle.
> . . . | . . . | . 1 2
> . . . | . . . | . . 3
> . . 2 | 3 . . | 4 . .
> ------+-------+------
> . . 1 | 8 . . | . . 5
> . 6 . | . 7 . | 8 . .
> . . . | . . 9 | . . .
> ------+-------+------
> . . 8 | 5 . . | . . .
> 9 . . | . 4 . | 5 . .
> 4 7 . | . . 6 | . . .
There should only be one solution. Enjoy yourself, and remember: No guessing! (Source: http://en.wikipedia.org/wiki/Algorithmics_of_sudoku#Exceptio...)
Re: Sudoku Solving
#23Earlier quoted context omitted.
solving without trial and error at all.
That strikes me as extremely unlikely . I think the complexity class of Sudoko is NP-Complete (a quick google confirms it's not exactly NP but very close: http://11011110.livejournal.com/23221.html?thread=19381 -- complexity is the same as solving SAT problems which have only one unique solution)
He discusses the strategies used here: http://www2.research.att.com/~gsf/sudoku/
Re: Sudoku Solving
#24Earlier quoted context omitted.
That strikes me as extremely unlikely . I think the complexity class of Sudoko is NP-Complete (a quick google confirms it's not exactly NP but very close: http://11011110.livejournal.com/23221.html?thread=19381 -- complexity is the same as solving SAT problems which have only one unique solution)
Glenn Flower has written an (open source) program that solves using constraint propagation only. It does solve some of the hardest Sudoku's. He discusses the strategies used here: http://www2.research.att.com/~gsf/sudoku/
> The solver uses depth first and/or breadth first with constraint propagation to prune the search
That would be backtracking.
Further, the purpose of many the constraint techniques seem to be aimed at creating puzzles that are amenable to humans, not solving them. The article itself states that for solving, backtracking with fewer constraints performs better.
Re: Sudoku Solving
#25Re: Sudoku Solving
#26Earlier quoted context omitted.
I'm curious... what would be the 'proper' technique?
solving without trial and error at all.
In some cases you might want the algorithm that solves them to also give you some kinda hint on how hard it would be for a human to solve it.
The most efficient algorithm I know of to solve these kind of problems is Knuth's Dancing Links X algorithm. It's beautiful and very fun to implement.
I have a simple ruby implementation of it geared to solve sudokus online on github: https://github.com/biilmann/Ruby-DLX-Sudoku-Solver
Re: Sudoku Solving
#27Sudoku Susser can solve sudoku puzzles not only the brute-force way shown in the article, but also using “human” reasoning, and show you all the steps.
Re: Sudoku Solving
#28Why did I do this? As computer security expert Ben Laurie has stated, Sudoku is "a denial of service attack on human intellect". My wife was infected by the virus, and I wanted to convince her that the problem had been solved and didn't need any more of her time. Very true.
Re: Sudoku Solving
#29Re: Sudoku Solving
#30Earlier quoted context omitted.
solving without trial and error at all.
If you do the constraint propagation right, the number of trials and errors will be very small (and it will be only one trial and no errors for the easy ones). I'd be very interested to see what an algorithm that solves any valid sudoku puzzle looks like. (apart from pathologic solutions like querying a database of all valid 9x9 sudoku combinations).
You might be interested in the article linked to by this post.