Sudoku Programmers Forum Index

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in          Games  Calendar

Log in to check your private messagesLog in to check your private messages   

what is the hardest known suduko ?
Goto page Previous  1, 2, 3 ... 9, 10, 11, 12, 13  Next
 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku
View previous topic :: View next topic  
Author Message
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Sat Dec 03, 2005 9:11 pm    Post subject: Reply with quote

Sudoku Assistant now solves these two puzzles. Very interesting ones.

OK, the deal here is that the "bifurcation" stuff amounts to trial-and-error depth, because it amounts to looking for singles again -- a new cycle, right?.

So I just allowed the hypothesis/proof engine to go ahead and look also for locked candidates, subsets, and grids (X-wings, swordfish, etc.) These last are all from the same function, so that wasn't any great work. -- Essentially do a full 2nd round of analysis short of figuring out a whole new set of chain calculation and hypothesis.

This cracks both of these puzzles in short order.

7.. ... 4..
.2. .7. .8.
..3 ..8 ..9

... 5.. 3..
.6. .2. .9.
..1 ..7 ..6

... 3.. 9..
.3. .4. .6.
..9 ..1 .35

Done! (52 steps) MP+

798 635 421
126 974 583
453 218 679

972 586 314
564 123 897
381 497 256

617 352 948
835 749 162
249 861 735




7.8 ... 3..
... 2.1 ...
5.. ... ...

.4. ... .26
3.. .8. ...
... 1.. .9.

.9. 6.. ..4
... .7. 5..
... ... ...



Done! (58 steps) WMP++

728 946 315
934 251 678
516 738 249

147 593 826
369 482 157
852 167 493

293 615 784
481 379 562
675 824 931


MP+ means "3d medusa and logical proof with a bit of depth (through locked candidates)"

WMP++ means "X-wing or swordfish and medusa and logical proof with depth (through subsets and X-wings/swordfish).

Obviously this story will continue -- harder Sudoku will be found. But so far I'd say these take the cake.
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dukuso

Joined: 14 Jul 2005
Posts: 424
:
Location: germany

Items
PostPosted: Sun Dec 04, 2005 1:28 am    Post subject: Reply with quote

when you just increase the level of lookahead, then, why is it
better to include locked candidates, x-wing etc. at all,
versus just using singles and one extra level of lookahead ?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Sun Dec 04, 2005 9:09 am    Post subject: Reply with quote

Are you asking why not just use singles entirely, and keep on branching?

The answer for me is that I didn't set up Sudoku Assistant to be fully recursive in terms of depth, and it was so easy to tap into what I already had. Doing the "bifurcation" -- looking for the next level of singles -- is essentially starting over in a new cycle.

I'm not claiming this solves all possible Sudoku -- I realize that would require full depth trial and error (the NP Complete issue, I think). But it's interesting that even these super-fiendish ones crack in just 50 steps or so just with this added bit of depth.

Actually, I believe that looking for n-tuples and X-wings amounts to adding an element of depth. These can't be found with simple forced chain logic. You have to say, "If X is true and Y is true, then ...," and that's depth.

But it's an interesting question. What I observe is that the solution goes quite rapidly, and since these functions add minimal effort to the solution, it seems to me they pay off.

Once you are in trial and error, I don't see why NOT to look for these things. The faster we can get to a disproof, the better, of course. So I'm sure just using singles but allowing full depth would do the job as well -- and probably faster. (My understanding is that that's what the dancing links algorithm does, but I can't say I understand exactly what's going on there. Knuth refers to it as depth backtracking, so I presume that all it's doing is straight singles. And I'm told that dancing links can be extremely slow with certain "renegade" Sudoku puzzles.)
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dukuso

Joined: 14 Jul 2005
Posts: 424
:
Location: germany

Items
PostPosted: Sun Dec 04, 2005 10:26 am    Post subject: Reply with quote

>Are you asking why not just use singles entirely, and keep on branching?

yes

>The answer for me is that I didn't set up Sudoku Assistant to be
>fully recursive in terms of depth, and it was so easy to tap into
>what I already had. Doing the "bifurcation" -- looking for the
>next level of singles -- is essentially starting over in a new cycle.
>
>I'm not claiming this solves all possible Sudoku -- I realize
>that would require full depth trial and error (the NP Complete
>issue, I think).

the NP-issue says nothing about 9*9-sudoku. Only that n*n-sudoku
will become very difficult when n becomes larger

>But it's interesting that even these super-fiendish ones crack
>in just 50 steps or so just with this added bit of depth.
>
>Actually, I believe that looking for n-tuples and X-wings
>amounts to adding an element of depth. These can't be found
>with simple forced chain logic. You have to say, "If X is
>true and Y is true, then ...," and that's depth.
>
>But it's an interesting question. What I observe is that the
>solution goes quite rapidly, and since these functions add
>minimal effort to the solution, it seems to me they pay off.
>
>Once you are in trial and error, I don't see why NOT to look
>for these things. The faster we can get to a disproof,
>the better, of course. So I'm sure just using singles
>but allowing full depth would do the job as well -- and
>probably faster.

.. with some additional tricks and modifications. See the puzzles-forum.
But these tricks to speed up the search e.g. for 25*25 sudokus
don't seem to contain any of your 12 rules except singles.

>(My understanding is that that's what the dancing links
>algorithm does,

dancing links just looks for a constraint with minimum possible
placements (usually 2, unless there are singles) and then
tries all the placements for that constraint.
It doesn't tell, what to do on ties, when there are
several constraints with two possible placements, though.
Here you can enter some improvement-ideas.

>but I can't say I understand exactly what's going on there.
>Knuth refers to it as depth backtracking, so I presume that
>all it's doing is straight singles.

essentially, yes

>And I'm told that dancing links can be extremely slow with
>certain "renegade" Sudoku puzzles.)

Then I'd say that any sudoku-solver can be "extremely slow"
with certain puzzles. I don't think there is a 9*9, where
dancing links takes more than 10ms


-Guenter
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Sun Dec 04, 2005 5:32 pm    Post subject: Reply with quote

Quote:
But these tricks to speed up the search e.g. for 25*25 sudokus
don't seem to contain any of your 12 rules except singles.


Not that I'm terribly interested in such large cases, but is there a good link to these tricks?
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dukuso

Joined: 14 Jul 2005
Posts: 424
:
Location: germany

Items
PostPosted: Mon Dec 05, 2005 1:03 am    Post subject: Reply with quote

http://magictour.free.fr/sudqwh.exe
(source code attached to the executable)
http://www.eleves.ens.fr/home/frisch/sudoku.html#strategy

or see any SAT-solver, since the currently most efficient
way seems to be to convert the sudoku into a SAT-instance
and then use a SAT-solver. The SAT-solver knows
nothing about sudoku-rules, of course.

for a description of the probably fastest SAT-solver
for large sudokus see:
www.ii.uam.es/~delval/ps/aaai04-qwh.pdf

you can get lots of SAT-solvers from:
http://www.intellektik.informatik.tu-darmstadt.de/SATLIB/solvers.html

you can convert sudokus to SAT-instances with:
http://magictour.free.fr/sud2sat.exe
Back to top
View user's profile Send private message Send e-mail Visit poster's website
JPF

Joined: 05 Dec 2005
Posts: 29
:
Location: Paris

Items
PostPosted: Tue Dec 06, 2005 12:07 am    Post subject: Reply with quote

Bob Hanson wrote:
Sudoku Assistant now solves these two puzzles. Very interesting ones.



7.. ... 4..
.2. .7. .8.
..3 ..8 ..9

... 5.. 3..
.6. .2. .9.
..1 ..7 ..6

... 3.. 9..
.3. .4. .6.
..9 ..1 .35

Done! (52 steps) MP+


Hi,
It seems to me that this grid is not a minimum one.
The r9c8 clue (3) is not necessary.
What does the Sudoku Assistant tell in that case ?

JPF
Back to top
View user's profile Send private message
thermosome

Joined: 22 Dec 2005
Posts: 2
:
Location: San Francisco

Items
PostPosted: Thu Dec 22, 2005 8:07 am    Post subject: Are any Sudokus hard? Reply with quote

Are any 9x9 sudokus hard? Are there any that will take most experienced (human) solvers more than an hour to solve? Here is some indirect evidence that suggests there are no hard 9x9 sudokus.

I looked at 32930 17-clue puzzles provided by Gordon:

http://www.csse.uwa.edu.au/~gordon/sudokumin.php

All of them can be solved with a depth 3 computer search. In other words at most 3 levels of guessing are needed. Most were solvable with 2 levels of guessing (28764), some with 1 level of guessing (2196), and some with 3 levels (1970).

It looks like many human (logical) solving techniques are equivalent to 2, 3 or higher levels of guessing. I realize it is a big leap to infer from this that there are no hard sudokus.

I ranked the 1970 17-clue puzzles that required 3 levels of guessing according to how many different first guesses produced a solution. Half of these puzzles could be solved at depth 3 with correct initial guesses in any of 48 cells. One puzzle required an initial guess in one specific cell. The next most difficult could be solve at depth 3 with initial guesses in 5 different cells. The exceptional puzzle that permitted only one initial guess I call "El Loco". It took about 2 hours for me to solve El Loco by hand. Here is that puzzle and the other 8 allowing a depth 3 solution with the fewest number of possible initial guesses. I named the others for easy reference.

A mathematical question:

Can all 9x9 sudokus be solved with a depth 3 search?

Tom

Code:

El Loco (most difficult)

. 2 . | . . . | . 5 .
. . . | . . 9 | 4 . .
. . . | 1 . . | . . .
------|-------|------
. . 8 | . 5 . | . 2 .
1 . . | . . . | . . .
4 . . | . . . | . . .
------|-------|------
9 . . | 8 . . | 1 . .
. . . | 3 . . | . . 6
. 4 . | . 2 . | . . .

Sunspot Sudoku (2nd most difficult)

. . . | . 3 1 | 2 . .
6 . 8 | . . . | . . .
. . . | . . . | . . .
------|-------|------
. 1 . | . . . | 3 . .
7 . . | 6 . . | . . .
. . . | . 5 . | . 4 .
------|-------|------
5 . . | . . . | . 6 3
. 3 . | . . . | . . 4
. . . | 2 . . | . . .

Samurai Sudoku (3rd most difficult)
                                                    
3 . . | . . . | 5 6 .
. . 8 | 2 . . | . . .
. . . | . . . | . . .
------|-------|------
1 4 . | . . 6 | . . .
. . 2 | . . . | 7 . .
. . . | . 3 . | . . .
------|-------|------
. . . | 7 . . | . . 2
5 . . | . 1 . | . . .
. 6 . | . . . | . 8 .

Happy Tree Sudoku (4th most difficult)

. 6 . | . . . | . 8 .
. . . | . . 5 | 3 . .
. . . | 1 . . | . . .
------|-------|------
5 . . | 2 . . | 7 . .
. . . | 3 . . | . . 1
. 4 . | . 6 . | . . .
------|-------|------
7 . . | . 8 . | . . .
. . . | . . . | . 6 4
1 . . | . . . | . . .


SoSo Sudoku (5th most difficult)
                                                    
. . . | . 2 1 | . . .
6 . . | . . . | 5 . .
7 . . | . . . | . 8 .
------|-------|------
4 . . | 8 . . | . . .
. 3 . | . . . | 2 . .
. 7 . | . . . | . . .
------|-------|------
5 . . | . 3 . | . . .
. . 2 | . . . | . . 1
. . . | 7 . . | . 4 .

Rojo Sudoku (6th most difficult)
                           
. . . | . 6 . | 5 . 4
7 . . | 3 . . | . . .
. . . | . . . | 8 . .
------|-------|------
2 . . | . . 8 | . . .
. . . | 1 . . | . 8 .
6 . . | . . . | . 3 .
------|-------|------
. 3 . | . 4 . | . . .
. . . | . . 5 | 2 . .
. 1 . | . . . | . . .

Sudoku Carrot (7th most difficult)

. 2 . | . . 1 | . . .
. . . | . 8 . | 9 . .
6 . . | . . . | . 5 .
------|-------|------
. . . | . . . | . 2 1
. . . | 6 3 . | . . .
. 4 . | . . . | . . .
------|-------|------
7 . 8 | . . . | 4 . .
5 . . | . . 7 | . . .
. . . | 2 . . | . . .

Sidewinder Sudoku (8th most difficult)

2 . . | . . 9 | . . .
. . . | 5 . . | 4 . .
. . . | . . . | 1 . .
------|-------|------
. . . | . . 6 | . . 7
. . 4 | . . . | . 3 .
. 2 . | . 1 . | . . .
------|-------|------
7 . . | 3 . . | . 8 9
. 5 . | . 4 . | . . .
. . . | . . . | . . .

Ecstatic Sudoku (9th most difficult)
                                                    
. 1 . | . 7 . | . . .
. . . | 4 . . | . 8 .
. . . | . . . | . . 9
------|-------|------
6 . . | . 5 . | 7 . .
5 . 3 | . . . | . . .
. . . | . . . | . . 1
------|-------|------
4 . . | 2 . . | . 5 .
. . . | . . 1 | 3 . .
. . . | . . 9 | . . .

And in single line format for computer solvers:

020000050000009400000100000008050020100000000400000000900800100000300006040020000
000031200608000000000000000010000300700600000000050040500000063030000004000200000
300000560008200000000000000140006000002000700000030000000700002500010000060000080
060000080000005300000100000500200700000300001040060000700080000000000064100000000
000021000600000500700000080400800000030000200070000000500030000002000001000700040
000060504700300000000000800200008000000100080600000030030040000000005200010000000
020001000000080900600000050000000021000630000040000000708000400500007000000200000
200009000000500400000000100000006007004000030020010000700300089050040000000000000
010070000000400080000000009600050700503000000000000001400200050000001300000009000
Back to top
View user's profile Send private message
Ruud
Site Admin
Joined: 17 Sep 2005
Posts: 708
:
Location: Netherlands

Items
PostPosted: Thu Dec 22, 2005 8:39 am    Post subject: Reply with quote

It is a common mistake to think that the most difficult Sudokus have to be the ones with the least clues. A search in the list of Gordon's 17s will reveal the most difficult from that list, but certainly not the most difficult known.

In fact, none of the 17s really requires guessing. Some require multiple forward implication chains, but no guesses.

At this moment (and this may change any time), this is the hardest known Sudoku:

Code:
7 . 8|. . .|3 . .
. . .|2 . 1|. . .
5 . .|. . .|. . .
-----+-----+-----
. 4 .|. . .|. 2 6
3 . .|. 8 .|. . .
. . .|1 . .|. 9 .
-----+-----+-----
. 9 .|6 . .|. . 4
. . .|. 7 .|5 . .
. . .|. . .|. . .


Only the best computer programs can solve it without backtracking.
It has no fancy name, just top1465#2.
And it has 18 clues, not 17.

Ruud.
_________________
Meet me at sudocue.net
Back to top
View user's profile Send private message Visit poster's website
gsf

Joined: 18 Aug 2005
Posts: 411
:
Location: NJ USA

Items
PostPosted: Thu Dec 22, 2005 11:04 am    Post subject: Re: Are any Sudokus hard? Reply with quote

thermosome wrote:
Are any 9x9 sudokus hard? Are there any that will take most experienced (human) solvers more than an hour to solve? Here is some indirect evidence that suggests there are no hard 9x9 sudokus.

I looked at 32930 17-clue puzzles provided by Gordon:

http://www.csse.uwa.edu.au/~gordon/sudokumin.php

All of them can be solved with a depth 3 computer search. In other words at most 3 levels of guessing are needed. Most were solvable with 2 levels of guessing (28764), some with 1 level of guessing (2196), and some with 3 levels (1970).


using the simplest constraints (F: only value in cell, N: only value in row/col/box) there are
Code:

15198 0-constrained
17248 1-constrained
  484 2-constrained

where n-constrained means that the puzzle is trivially solved by applying FN constraints after n specific cells are filled in

these specific cells are the magic or backdoor cells

it looks like there may be no 3-constrained or greater 9x9 sudoku, but that's still an open question

a backtrack search based on FN constraints would not have to backtrack on 0-constrained puzzles

a pure breadth first backtrack search would require at most n levels to solve n-constrained puzzles

a depth first search may require many more than n levels depending on its branch heuristic

but a backtrack search with 1 level forward check can solve all of the 17's with no backtracking -- my solver solves these at about 7000/sec/GHz

so from the viewpoint of forward checking there aren't many hard 9x9 sudoku -- but forward checking is not how an efficient human solves

your hardest list contained a few 0-constrained puzzles, so you might need to check your constraint propagation code

here are the backdoors for your list
Code:

#1 0 constrained
#2 0 constrained
#3 0 constrained
#4 1 [2,1]=8[2,2]=7[2,3]=9[2,5]=4[2,9]=2[3,1]=4[3,2]=3[3,3]=5
        [3,5]=2[3,8]=9[3,9]=7[6,7]=2[6,9]=9[7,2]=5[7,3]=6[7,4]=4
        [7,6]=9[7,8]=2[8,1]=9[8,2]=8[8,3]=3[9,2]=2[9,3]=4[9,4]=5
        [9,6]=6
#5 0 constrained
#6 0 constrained
#7 1 [1,3]=5[1,4]=9[2,4]=5[3,3]=9
#8 1 [1,3]=5[3,3]=6[3,9]=5[4,3]=9[4,7]=5[5,1]=6[5,5]=8[5,6]=5
        [6,1]=5[7,5]=5
#9 0 constrained
Back to top
View user's profile Send private message Visit poster's website
gsf

Joined: 18 Aug 2005
Posts: 411
:
Location: NJ USA

Items
PostPosted: Thu Dec 22, 2005 11:20 am    Post subject: Reply with quote

Ruud wrote:

At this moment (and this may change any time), this is the hardest known Sudoku:

Code:
7 . 8|. . .|3 . .
. . .|2 . 1|. . .
5 . .|. . .|. . .
-----+-----+-----
. 4 .|. . .|. 2 6
3 . .|. 8 .|. . .
. . .|1 . .|. 9 .
-----+-----+-----
. 9 .|6 . .|. . 4
. . .|. 7 .|5 . .
. . .|. . .|. . .


Only the best computer programs can solve it without backtracking.
It has no fancy name, just top1465#2.
And it has 18 clues, not 17.

this puzzle is 2-constrained with 16 backdoor pairs
899 of the top1465 are 1-constrained, 565 are 2-constrained
puzzles { 2 3 77 84 } require forward check backtrack guessing
the remainder are solved without forward check backtracking
Back to top
View user's profile Send private message Visit poster's website
dukuso

Joined: 14 Jul 2005
Posts: 424
:
Location: germany

Items
PostPosted: Thu Dec 22, 2005 11:39 am    Post subject: Reply with quote

what exactly is forward check backtrack guessing ?



BTW. top1465 is here:
http://magictour.free.fr/top1465
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gsf

Joined: 18 Aug 2005
Posts: 411
:
Location: NJ USA

Items
PostPosted: Thu Dec 22, 2005 12:01 pm    Post subject: Reply with quote

dukuso wrote:
what exactly is forward check backtrack guessing ?

google "forward check haralick" for detailed treatment of forward checking

basically a forward check picks a few or all candidate cells and applies the constraints to a few or all candidate values before committing to a cell/value for the next backtrack level

if a forward check attempts all cells/candidate values then the success/failure of the constraints for each attempt can result in problem simplification before the next backtrack

for problems with small backdoor size (e.g., like 1 or 2 for 9x9 sudoku) the first forward check may produce a solution without backtracking at all

so a "forward check backtrack guess" is where you end up when the forward check at the current backtrack level makes no further progress -- you make a guess at the best candidate cell+value to commit to on the next backtrack level
Back to top
View user's profile Send private message Visit poster's website
dukuso

Joined: 14 Jul 2005
Posts: 424
:
Location: germany

Items
PostPosted: Thu Dec 22, 2005 12:10 pm    Post subject: Reply with quote

thanks.
can you check :

"forward check haralick"

this gives no entry at google
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gsf

Joined: 18 Aug 2005
Posts: 411
:
Location: NJ USA

Items
PostPosted: Thu Dec 22, 2005 9:27 pm    Post subject: Reply with quote

dukuso wrote:
thanks.
can you check :

"forward check haralick"

this gives no entry at google

aha, try without the double quotes
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku All times are GMT
Goto page Previous  1, 2, 3 ... 9, 10, 11, 12, 13  Next
Page 10 of 13

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Sudoku Programmers topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group

Igloo Theme Version 1.0 :: Created By: Andrew Charron