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   

Question on benchmarks

 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Programming sudoku
View previous topic :: View next topic  
Author Message
briturner

Joined: 14 Oct 2008
Posts: 75
:

Items
PostPosted: Tue Oct 14, 2008 4:31 pm    Post subject: Question on benchmarks Reply with quote

Greetings,

This is my first post, but I have been reading posts on and off for a couple months now after writing my Sudoku solver based on automating my manual method.

I have a few questions on benchmarks and puzzles:

First, some background:
I wrote a general purpose Sudoku solver that can handle 3x2, 3x3, 4x4, 5x5, and 7x4 (other sizes are possible, but those are the only test cases I had). It also is designed to handle overlap puzzles of any valid size (including mixed sizes). My biggest test case is 59 overlapping 3x3 puzzles.

My algorithm uses a combination of logically solving, and then guessing and backtracking. I am looking at picking algorithms for fast solving, so I implemented some more logic that eliminated some guessing, but it took longer than just guessing. I also stop once a valid answer is found, so if there are multiple answers, I only find one.

I use straight C (Visual C version 6), and do not use any embedded assembly since that should be the last resort of any optimization (only to be done once all algorithmic optimizations are in).

My first question, is what is considered a good speed for solving? I ran the top1465 through my solver (1.8 GHz laptop, output disabled) and solved them in 0.843 seconds (575 microseconds per puzzle). What do other people get for times?

Secondly, is there any standard set of puzzles for the larger groups (like 4x4 or 5x5, or overlapped puzzles)?

Thank
brit
Back to top
View user's profile Send private message
m_b_metcalf

Joined: 13 Mar 2006
Posts: 210
:
Location: Berlin

Items
PostPosted: Tue Oct 14, 2008 6:36 pm    Post subject: Re: Question on benchmarks Reply with quote

briturner wrote:
Greetings,

Secondly, is there any standard set of puzzles for the larger groups (like 4x4 or 5x5, or overlapped puzzles)?


Greetings to you too, and welcome. Not that I know of, but you can try this 49x49, which takes me 7s to solve:

Quote:

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . 10 . 24 13 41 . . . 37 . . . 1 34 30 . 38 . . . . . . . . . . . . . . . .
. . . . . . . . . . . . 32 . . 6 . 33 . 28 8 21 18 7 35 5 3 29 44 11 . 27 . 16 . . 40 . . . . . . . . . . . .
. 47 . . . 7 . 28 25 9 5 . . 11 49 . . . . 42 . 13 . . 19 . . 31 . 29 . . . . 15 4 . . 30 16 27 2 . 34 . . . 3 .
. . . 21 48 . 43 4 24 . 46 22 . . 11 . 3 37 25 . . 42 40 49 14 15 16 23 . . 20 7 5 . 35 . . 13 8 . 31 12 26 . 41 38 . . .
. 35 . 41 . 37 33 17 1 12 16 8 3 27 . 14 . . 15 43 47 . . 39 2 25 . . 45 21 19 . . 32 . 48 28 49 42 26 29 6 11 44 . 40 . 23 .
40 3 27 8 . . 26 37 . . 29 35 31 41 . 22 39 . 7 . 30 32 48 . . . 24 28 4 . 49 . 25 10 . 17 11 18 20 . . 34 13 . . 36 21 5 19
. . . 23 . 10 28 . 19 . . . . . . . 29 . . . . . . . 13 . . . . . . . 24 . . . . . . . 35 . 16 9 . 27 . . .
9 . . . 47 . 15 14 . . 41 . . 46 . . 18 . 38 . 19 . 17 6 4 26 28 . 16 . 2 . 7 . . 1 . . 13 . . 21 35 . 32 . . . 23
35 . 12 19 . . 46 10 11 23 . 13 22 . . 42 . . 5 . . 39 49 . . . 8 47 . . 3 . . 20 . . 16 40 . 29 9 30 38 . . 2 4 . 15
11 22 8 . 4 29 . . 48 44 . 45 16 1 . 12 32 28 . . 13 . 7 . 24 . 33 . 37 . . 31 35 38 . 18 6 42 . 39 17 . . 47 14 . 26 43 40
3 40 26 16 . . 32 . . 28 2 15 . . 45 43 . 17 . 33 . 1 . 46 22 35 . 19 . 23 . 10 . 42 6 . . 11 47 5 . . 29 . . 30 48 44 34
41 34 . . 17 . 36 . 7 5 43 . 47 38 35 . 4 . 1 2 48 30 . 16 . 37 . 27 32 25 39 . 49 . 13 10 12 . 26 46 14 . 22 . 20 . . 18 45
. 2 24 49 . 43 . . 17 4 26 3 6 35 . . 21 11 9 44 16 14 32 10 . 45 23 5 29 1 34 48 27 . . 28 19 22 37 36 20 . . 31 . 39 13 46 .
22 . . . 31 25 37 . . . 12 19 . 26 . . 49 6 43 . 20 . . 17 9 11 . . 15 . 21 47 32 . . 5 . 2 18 . . . 48 38 45 . . . 44
24 1 2 . 49 . . . 15 32 . . 29 . . 13 . 23 . 9 . . 25 . 3 . 21 . . 30 . 41 . 17 . . 35 . . 44 45 . . . 39 . 11 26 14
. . 20 . 32 34 . 22 10 . 18 4 23 45 19 15 16 7 44 . . . 37 28 8 41 40 . . . 9 24 14 3 5 33 31 21 36 . 39 1 . 35 2 . 49 . .
13 44 . 46 40 45 4 . 20 . 42 . 43 . 22 29 . 26 . 21 . 19 . . 36 . . 39 . 48 . 23 . 34 18 . 24 . 49 . 41 . 7 37 27 32 . 33 1
. 12 . 15 21 . 47 11 49 . 36 . 39 . 42 17 45 1 4 31 . 34 43 26 5 22 48 16 . 20 7 40 6 35 44 . 8 . 29 . 19 38 46 . 3 25 . 30 .
33 . 16 9 . 14 48 21 40 1 . 27 37 . 39 . 30 41 34 . . . 44 . 20 . 18 . . . 4 13 10 . 8 . 25 26 . 3 46 7 31 15 . 29 17 . 47
10 41 . 39 35 . 6 5 9 16 44 . 2 14 47 11 25 . 37 . 33 . 45 32 . 13 1 . 22 . 31 . 12 29 19 43 15 . 27 42 48 17 18 . 24 34 . 8 36
. 9 22 11 42 38 44 . 41 27 . . 35 . . . . 29 40 34 36 45 14 . . . 46 33 8 28 18 43 . . . . 4 . . 6 15 . 32 48 17 49 16 7 .
28 . 1 30 . 33 10 . . 37 8 42 49 . . . 27 24 23 12 26 35 2 . 6 . 47 32 48 14 46 11 9 . . . 39 20 45 43 . . 15 13 . 19 31 . 5
47 27 . 34 . 17 . 9 13 15 11 20 30 . 8 . 37 14 21 . 1 43 38 . 23 . 44 4 7 . 10 22 19 . 12 . 26 48 2 18 40 32 . 29 . 45 . 41 28
. 31 . . 8 46 23 3 . . . 16 25 . 33 . 28 10 6 4 . 29 19 1 . 49 42 37 . 13 5 45 15 . 40 . 22 14 . . . 44 9 39 12 . . 24 .
2 49 . 40 . 26 . 32 28 46 10 34 18 . 7 . 20 48 3 . 45 15 5 . 39 . 22 11 23 . 35 16 41 . 4 . 37 38 33 9 42 29 . 27 . 47 . 14 21
14 . 48 6 . 4 19 . . 2 23 36 45 . . . 11 35 42 18 49 7 20 . 40 . 31 34 30 27 24 38 29 . . . 13 41 28 1 . . 44 33 . 46 8 . 22
. 15 45 5 7 21 20 . 4 39 . . 19 . . . . 9 22 32 31 48 3 . . . 27 13 36 47 37 1 . . . . 10 . . 8 49 . 34 2 23 26 18 35 .
15 23 . 31 11 . 9 1 42 22 30 . 5 21 10 45 41 . 26 . 38 . 46 43 . 34 4 . 47 . 29 . 48 13 14 40 33 . 25 35 18 37 20 . 19 16 . 28 3
7 . 4 14 . 3 40 19 31 45 . 43 46 . 44 . 42 18 35 . . . 1 . 49 . 5 . . . 41 34 17 . 10 . 23 15 . 48 11 20 25 30 . 21 47 . 39
. 21 . 45 22 . 13 24 3 . 9 . 7 . 34 31 36 8 11 6 . 10 28 44 18 23 26 41 . 16 1 25 37 4 46 . 30 . 17 . 32 39 33 . 38 42 . 29 .
38 19 . 17 39 18 41 . 16 . 15 . 4 . 14 9 . 5 . 40 . 37 . . 11 . . 7 . 31 . 49 . 24 27 . 2 . 1 . 12 . 36 23 10 43 . 34 6
. . 34 . 12 49 . 35 39 . 32 38 17 18 24 7 33 3 13 . . . 31 21 16 27 25 . . . 23 30 20 36 28 22 45 6 44 . 43 10 . 5 26 . 46 . .
16 28 47 . 27 . . . 26 11 . . 10 . . 19 . 46 . 49 . . 12 . 42 . 20 . . 7 . 44 . 43 . . 38 . . 21 34 . . . 31 . 22 13 32
6 . . . 44 2 25 . . . 33 28 . 36 . . 43 20 16 . 12 . . 48 47 19 . . 21 . 38 9 22 . . 13 . 31 4 . . . 40 11 8 . . . 7
. 18 44 1 . 16 . . 33 17 22 23 24 39 . . 13 32 28 41 40 6 26 19 . 21 10 42 3 2 12 35 11 . . 47 29 45 43 34 36 . . 8 . 9 38 48 .
25 29 . . 6 . 49 . 12 31 28 . 42 20 27 . 15 . 39 48 17 23 . 3 . 7 . 18 43 38 47 . 34 . 1 14 46 . 19 4 8 . 37 . 16 . . 2 11
37 10 43 22 . . 45 . . 40 27 46 . . 20 38 . 42 . 7 . 12 . 31 48 28 . 9 . 5 . 18 . 21 36 . . 1 15 11 . . 47 . . 14 41 19 29
19 14 46 . 24 47 . . 5 7 . 9 8 34 . 36 6 44 . . 10 . 16 . 43 . 2 . 41 . . 28 39 37 . 21 27 35 . 22 38 . . 17 13 . 12 32 49
4 . 28 7 . . 38 30 32 10 . 14 44 . . 21 . . 18 . . 49 41 . . . 11 45 . . 27 . . 9 . . 42 24 . 20 6 48 23 . . 35 34 . 26
36 . . . 15 . 21 13 . . 37 . . 48 . . 12 . 45 . 23 . 34 5 29 14 32 . 24 . 22 . 46 . . 16 . . 39 . . 49 27 . 43 . . . 4
. . . 48 . 27 17 . 43 . . . . . . . 31 . . . . . . . 15 . . . . . . . 45 . . . . . . . 10 . 42 25 . 3 . . .
1 20 29 4 . . 16 48 . . 17 10 21 28 . 24 22 . 19 . 11 18 15 . . . 49 40 14 . 25 . 42 23 . 7 43 34 32 . . 36 41 . . 12 2 6 31
. 38 . 26 . 24 22 7 44 35 4 12 9 23 . 1 . . 2 5 34 . . 11 41 30 . . 20 18 8 . . 27 . 6 47 29 48 40 33 31 39 16 . 13 . 49 .
. . . 2 41 . 14 46 45 . 3 37 . . 31 . 44 16 36 . . 33 10 27 1 32 34 12 . . 13 6 4 . 39 . . 19 11 . 21 28 30 . 35 24 . . .
. 42 . . . 32 . 26 34 29 39 . . 5 6 . . . . 15 . 31 . . 44 . . 35 . 36 . . . . 11 45 . . 10 24 37 22 . 46 . . . 1 .
. . . . . . . . . . . . 40 . . 18 . 45 . 3 32 8 22 14 38 9 7 17 10 41 . 5 . 28 . . 1 . . . . . . . . . . . .
. . . . . . . . . . . . . . . . 35 . 41 20 28 . . . 46 . . . 17 24 45 . 1 . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


('quote' rather than 'code', as 'code' can't be shrunk).

Regards,

Mike Metcalf
Back to top
View user's profile Send private message
briturner

Joined: 14 Oct 2008
Posts: 75
:

Items
PostPosted: Wed Oct 15, 2008 12:31 pm    Post subject: Reply with quote

Thanks,

I tried plugging in this puzzle, and my solver failed Sad

I use bit masks for part of my solver, and 49 bits overflowed my 32 bit integer. I will need to re-write my solver to handle the larger sizes. My previous puzzles had a max of 28 (4x7), so it was not a problem.

Most my larger puzzles I got out of the magazine which I can't list because I can't post Japanese characters, and I can't link to due to board restrictions. They also have PDFs of overlapping Sudoku you can download off their site. Their magazine has an 8 page fold out with really large puzzles (last month had the 59 overlapping Sudoku, an 8 page slitherlink, and a 3 page Kakuro puzzle).

If anyone is interested in the link to the magazine, or the sample PDFs, let me know any maybe I can private message them. I have a friend in Japan who mails them to me, I can't find anyplace in the US that carries them.

brit
Back to top
View user's profile Send private message
m_b_metcalf

Joined: 13 Mar 2006
Posts: 210
:
Location: Berlin

Items
PostPosted: Wed Oct 15, 2008 2:03 pm    Post subject: Reply with quote

Try this one. Takes me 0.3s.

Code:

 16  .  .  .  .  .  .  .  .  2  9 13  . 19 18 24  5  .  .  .  .  3  8  .  .
  .  .  .  . 25  6  .  9 12  .  .  2  .  .  3 13  . 16 22  .  .  .  .  1  4
  .  . 19  .  . 13  . 10  .  .  .  .  . 20  .  .  .  .  4  .  .  .  .  .  .
  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
 14  . 22  9 17  . 18  .  . 25  4 11  5  . 21 19 20  1 15  2  . 24  .  7  .
  . 17 15  6  .  4  .  .  1  .  8  .  .  . 20  . 25  5  . 16  .  . 10  .  .
  .  .  .  .  .  .  .  .  .  .  .  .  . 17  .  .  .  .  .  .  .  .  .  .  .
  7 18  2 12  .  . 11  3  6  5 24  . 14  .  .  .  . 17  .  .  .  .  . 16 13
  9 13  .  4  . 17  . 20  . 16 10  1  3  2  5  7 15  .  . 18  .  . 24  . 22
  .  .  .  .  3  . 21  .  2  .  .  .  . 18 25  .  .  . 23 22  1  8  . 20  .
  8 16 13  . 23  .  . 18 21  .  . 15 12  .  .  .  9  .  .  6  3 20 11  .  .
  .  .  .  . 10  .  . 24 25  .  7  .  .  .  .  .  .  .  .  .  .  .  .  .  .
  4  . 18 22 21 10 16  8  .  3  .  .  .  .  .  . 11  .  5 20  .  .  . 13  .
  .  5  .  1  .  . 14 15  .  .  .  .  9 25  .  .  .  . 13  .  .  4 18  6  8
  .  . 25  .  7  1  6 11  5 13 23 20 16  .  .  4 18  . 10 24 22  . 21 14  .
  3  .  .  . 20  . 24  2 13 12  1  .  .  .  .  5  6 19  .  .  8 10  .  9 17
 15  .  9  . 16  .  . 17  8  . 14  6 22  .  . 18  .  .  7  .  5  .  . 24 11
  .  .  .  . 22  .  9  .  .  .  .  .  .  3  .  .  2  . 16  .  .  .  .  .  .
 10  . 23 25  .  7  1 16  .  .  .  . 18  .  9 11 24  . 20  .  .  .  . 15  .
  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
 12  .  . 14  5  .  . 19  .  9  .  . 10  .  .  .  3 20  .  7  . 25  1  .  .
  .  .  . 17  1  .  . 25 22  .  .  .  . 14  .  2 10  . 21 19 24  6  . 23 18
  . 10  . 15  .  .  7  . 17  .  5 12 23  6 22  9  .  4 25  . 21  . 20  .  .
  .  .  7  2  .  3  .  . 18 15 20  . 25 13 24  .  .  .  1  . 12 19  .  .  .
 22  .  .  .  .  8  .  .  4 24  .  . 11 21  . 15  .  .  . 17  .  7  .  . 16

Regards,

Mike Metcalf
Back to top
View user's profile Send private message
briturner

Joined: 14 Oct 2008
Posts: 75
:

Items
PostPosted: Wed Oct 15, 2008 2:31 pm    Post subject: Reply with quote

I use ascii art for the results, which don't post well, but this one works (less than 32 bits needed). My solver uses a combination of logic and backtracking. I wrote it before finding these forums, so I just programmed my manual method, nothing real advanced. Here is what I got:

Solved in 0.094 seconds, Max depth of 32.
Calcs = 1922, Guesses = 451.

I have some things to do to my solver now:
- add option to search for multiple solutions
- make an optimized version for 9x9 and 16x16
(just curious how much it helps)
- make a larger than 32 bit version
- improve puzzle import
(I currently have to tweak puzzles to my format)
- provide options to turn on and off different techniques

so, still a ways to go
brit
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Programming sudoku All times are GMT
Page 1 of 1

 
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