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   

4x4 complexity - estimating max solving time

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

Joined: 15 Jul 2005
Posts: 1
:

Items
PostPosted: Fri Jul 15, 2005 9:46 pm    Post subject: 4x4 complexity - estimating max solving time Reply with quote

Hi all,

I'm quite new to writing sudoku solvers. However, I wrote nice-working 9x9 solver in C++ with STL library. It isn't something well distinguished, but works for all tested cases.

My method in 9x9 is quite simple: I declare 27 tables, each for a row, each for a column, and each for a 3x3 square. Those are containing informations about all possible digits in adequate cols, rows & squares. Besides for each cell I create a list of already tested digits. Now when I put a digit into cell, I remove it from three tables and put it into proper tested list. After all combinations are tested and wrong, I make a fallback, make some clean-up and try with a new digit.

Now I found somewhere 16x16 sudoku grids, decided to convert my program into new grid size and all tested grids are solved within 10 seconds. But one breaks the rule. It isn't to be solved within 2 days of continous work of PIV processor (and still computing).
My question is: is there something wrong in my algorithm (maybe I overlooked something) or sudoku complexity with this case and my algorithm are combining in some long-time counting?

Here's the grid:
Code:

  5 |B  2|4  E| A 
 9 8|  6 | 1  |2 7
E B | 3  |  6 | 8 F
 1  |D  7|A  G|  C
-------------------
B  4|  5 | 3  |D  6
  C | F  |  D | G 
 F  |7  B|9  C|  1
6  D|  C | B  |3  E
-------------------
A  3|  E | G  |5  8
 2  |5  8|D  6|  9
  F | G  |  C | 6 
D  B|  1 | E  |7  2
-------------------
 7  |C  4|8  9|  F
8 G | A  |  3 | B 5
 E 1|  9 | F  |8 2
  6 |2  G|C  1| 3 


I don't see any bugs in my algorithm, but it can also be possible.
Any help will be appreciated.

Greetings
Radek
Back to top
View user's profile Send private message
jaap

Joined: 13 Jun 2005
Posts: 24
:
Location: NL

Items
PostPosted: Sat Jul 16, 2005 2:29 pm    Post subject: Re: 4x4 complexity - estimating max solving time Reply with quote

radek wrote:

But one breaks the rule. It isn't to be solved within 2 days of continous work of PIV processor (and still computing).
My question is: is there something wrong in my algorithm (maybe I overlooked something) or sudoku complexity with this case and my algorithm are combining in some long-time counting?


This one is fairly straightforward, but your simple rules are not enough to deduce everything in this case. Maybe your backtracking is not quite correct, and the other 4x4 puzzles you tested don't actually need any backtracking.

Below is the output from my solver:

Code:

Only one possibility for digit 11 in column 2
Placing number 11 at (16,2)
Only one possibility for digit 15 in column 13
Placing number 15 at (10,13)
Only one possibility for digit 12 in column 13
Placing number 12 at (14,13)
Only one possibility for digit 12 in column 16
Placing number 12 at (10,16)
Only one possibility for location (12,14)
Placing number 4 at (12,14)
Only one possibility for digit 12 in column 14
Placing number 12 at (5,14)
Only one possibility for digit 15 in column 14
Placing number 15 at (8,14)
Only one possibility for digit 2 in column 14
Placing number 2 at (7,14)
Only one possibility for digit 7 in column 14
Placing number 7 at (15,14)
Only one possibility for digit 9 in column 14
Placing number 9 at (4,14)
Only one possibility for digit 5 in column 14
Placing number 5 at (2,14)
Only one possibility for digit 7 in column 16
Placing number 7 at (6,16)
Only one possibility for digit 9 in column 16
Placing number 9 at (16,16)
Only one possibility for digit 9 in column 13
Placing number 9 at (6,13)
Only one possibility for digit 9 in column 1
Placing number 9 at (11,1)
Only one possibility for location (12,3)
Placing number 8 at (12,3)
Only one possibility for digit 9 in column 4
Placing number 9 at (14,4)
Only one possibility for digit 11 in row 6
Placing number 11 at (6,15)
Only one possibility for location (9,15)
Placing number 13 at (9,15)
Only one possibility for location (9,14)
Placing number 1 at (9,14)
Only one possibility for location (10,14)
Placing number 14 at (10,14)
Only one possibility for location (13,14)
Placing number 13 at (13,14)
Only one possibility for digit 5 in column 15
Placing number 5 at (8,15)
Only one possibility for digit 8 in column 15
Placing number 8 at (5,15)
Only one possibility for digit 3 in row 10
Placing number 3 at (10,7)
Only one possibility for location (13,7)
Placing number 11 at (13,7)
Only one possibility for digit 1 in row 11
Placing number 1 at (11,9)
Only one possibility for digit 14 in row 11
Placing number 14 at (11,4)
Only one possibility for digit 12 in row 15
Placing number 12 at (15,1)
Only one possibility for digit 14 in box 4
Placing number 14 at (4,13)
Only one possibility for digit 11 in column 13
Placing number 11 at (11,13)
Only one possibility for digit 6 in row 4
Placing number 6 at (4,4)
Only one possibility for digit 16 in box 12
Placing number 16 at (12,15)
Only one possibility for location (3,15)
Placing number 4 at (3,15)
Possibilities for digit 12 in column 4 force digit 12 in box 1
Possibilities for digit 8 in column 5 force digit 8 in box 6
Possibilities for digit 9 in column 10 force digit 9 in box 3
Possibilities for digit 12 in row 2 force digit 12 in box 2
Possibilities for digit 3 in row 7 force digit 3 in box 5
Only one possibility for digit 3 in column 2
Placing number 3 at (1,2)
Only one possibility for location (1,15)
Placing number 6 at (1,15)
Only one possibility for location (14,15)
Placing number 14 at (14,15)
Only one possibility for location (16,15)
Placing number 10 at (16,15)
Only one possibility for location (11,15)
Placing number 3 at (11,15)
Only one possibility for location (11,16)
Placing number 10 at (11,16)
Only one possibility for location (7,16)
Placing number 4 at (7,16)
Only one possibility for location (7,13)
Placing number 10 at (7,13)
Only one possibility for location (11,5)
Placing number 4 at (11,5)
Only one possibility for location (11,2)
Placing number 5 at (11,2)
Only one possibility for location (11,8)
Placing number 13 at (11,8)
Only one possibility for location (15,16)
Placing number 16 at (15,16)
Only one possibility for location (13,16)
Placing number 1 at (13,16)
Only one possibility for location (1,16)
Placing number 13 at (1,16)
Only one possibility for location (13,13)
Placing number 6 at (13,13)
Only one possibility for location (16,13)
Placing number 4 at (16,13)
Only one possibility for digit 3 in row 4
Placing number 3 at (4,16)
Only one possibility for location (2,16)
Placing number 11 at (2,16)
Only one possibility for location (2,11)
Placing number 15 at (2,11)
Only one possibility for location (2,9)
Placing number 3 at (2,9)
Only one possibility for location (2,12)
Placing number 13 at (2,12)
Only one possibility for digit 13 in column 3
Placing number 13 at (15,3)
Only one possibility for location (14,2)
Placing number 4 at (14,2)
Only one possibility for digit 13 in column 2
Placing number 13 at (3,2)
Only one possibility for digit 3 in column 12
Placing number 3 at (12,12)
Only one possibility for digit 11 in row 4
Placing number 11 at (4,11)
Only one possibility for digit 11 in row 10
Placing number 11 at (10,6)
Only one possibility for digit 16 in row 13
Placing number 16 at (13,11)
Only one possibility for digit 14 in row 13
Placing number 14 at (13,6)
Only one possibility for digit 14 in row 16
Placing number 14 at (16,11)
Only one possibility for digit 14 in row 7
Placing number 14 at (7,3)
Only one possibility for digit 3 in column 3
Placing number 3 at (13,3)
Only one possibility for digit 3 in column 1
Placing number 3 at (7,1)
Only one possibility for digit 10 in box 13
Placing number 10 at (13,4)
Only one possibility for digit 10 in box 1
Placing number 10 at (2,3)
Only one possibility for digit 2 in box 13
Placing number 2 at (13,1)
Only one possibility for location (13,10)
Placing number 5 at (13,10)
Only one possibility for digit 5 in row 4
Placing number 5 at (4,6)
Only one possibility for location (15,6)
Placing number 6 at (15,6)
Only one possibility for location (7,6)
Placing number 13 at (7,6)
Only one possibility for location (7,7)
Placing number 16 at (7,7)
Only one possibility for location (3,7)
Placing number 10 at (3,7)
Only one possibility for location (7,4)
Placing number 5 at (7,4)
Only one possibility for location (6,1)
Placing number 1 at (6,1)
Only one possibility for location (6,4)
Placing number 2 at (6,4)
Only one possibility for location (6,7)
Placing number 4 at (6,7)
Only one possibility for location (7,11)
Placing number 8 at (7,11)
Only one possibility for location (1,11)
Placing number 7 at (1,11)
Only one possibility for location (7,10)
Placing number 6 at (7,10)
Only one possibility for location (6,10)
Placing number 10 at (6,10)
Only one possibility for location (6,2)
Placing number 8 at (6,2)
Only one possibility for location (6,12)
Placing number 5 at (6,12)
Only one possibility for location (3,12)
Placing number 2 at (3,12)
Only one possibility for location (3,9)
Placing number 5 at (3,9)
Only one possibility for location (4,10)
Placing number 8 at (4,10)
Only one possibility for location (4,7)
Placing number 15 at (4,7)
Only one possibility for location (1,7)
Placing number 8 at (1,7)
Only one possibility for location (4,1)
Placing number 4 at (4,1)
Only one possibility for location (2,1)
Placing number 16 at (2,1)
Only one possibility for location (1,1)
Placing number 15 at (1,1)
Only one possibility for location (1,4)
Placing number 12 at (1,4)
Only one possibility for location (1,10)
Placing number 9 at (1,10)
Only one possibility for location (1,6)
Placing number 1 at (1,6)
Only one possibility for location (1,13)
Placing number 16 at (1,13)
Only one possibility for location (2,5)
Placing number 14 at (2,5)
Only one possibility for location (2,8)
Placing number 12 at (2,8)
Only one possibility for location (2,6)
Placing number 4 at (2,6)
Only one possibility for location (3,4)
Placing number 7 at (3,4)
Only one possibility for location (3,8)
Placing number 9 at (3,8)
Only one possibility for location (3,5)
Placing number 16 at (3,5)
Only one possibility for location (3,10)
Placing number 12 at (3,10)
Only one possibility for location (3,13)
Placing number 1 at (3,13)
Only one possibility for location (4,3)
Placing number 2 at (4,3)
Only one possibility for location (6,9)
Placing number 14 at (6,9)
Only one possibility for location (10,1)
Placing number 7 at (10,1)
Only one possibility for location (9,3)
Placing number 4 at (9,3)
Only one possibility for location (10,3)
Placing number 1 at (10,3)
Only one possibility for location (10,4)
Placing number 16 at (10,4)
Only one possibility for location (10,10)
Placing number 4 at (10,10)
Only one possibility for location (10,11)
Placing number 10 at (10,11)
Only one possibility for location (12,9)
Placing number 15 at (12,9)
Only one possibility for location (14,12)
Placing number 7 at (14,12)
Only one possibility for location (5,12)
Placing number 15 at (5,12)
Only one possibility for location (8,12)
Placing number 4 at (8,12)
Only one possibility for location (9,12)
Placing number 11 at (9,12)
Only one possibility for location (11,12)
Placing number 8 at (11,12)
Only one possibility for location (14,7)
Placing number 13 at (14,7)
Only one possibility for location (14,10)
Placing number 2 at (14,10)
Only one possibility for location (11,10)
Placing number 7 at (11,10)
Only one possibility for location (9,9)
Placing number 2 at (9,9)
Only one possibility for location (9,11)
Placing number 9 at (9,11)
Only one possibility for location (11,7)
Placing number 2 at (11,7)
Only one possibility for location (12,11)
Placing number 5 at (12,11)
Only one possibility for location (14,9)
Placing number 6 at (14,9)
Only one possibility for location (15,5)
Placing number 3 at (15,5)
Only one possibility for location (6,5)
Placing number 6 at (6,5)
Only one possibility for location (6,8)
Placing number 3 at (6,8)
Only one possibility for location (9,5)
Placing number 15 at (9,5)
Only one possibility for location (9,8)
Placing number 6 at (9,8)
Only one possibility for location (9,2)
Placing number 12 at (9,2)
Only one possibility for location (9,6)
Placing number 7 at (9,6)
Only one possibility for location (12,2)
Placing number 6 at (12,2)
Only one possibility for location (12,8)
Placing number 10 at (12,8)
Only one possibility for location (8,8)
Placing number 1 at (8,8)
Only one possibility for location (5,8)
Placing number 14 at (5,8)
Only one possibility for location (8,11)
Placing number 2 at (8,11)
Only one possibility for location (5,11)
Placing number 1 at (5,11)
Only one possibility for location (8,6)
Placing number 9 at (8,6)
Only one possibility for location (5,5)
Placing number 10 at (5,5)
Only one possibility for location (5,2)
Placing number 16 at (5,2)
Only one possibility for location (5,6)
Placing number 2 at (5,6)
Only one possibility for location (5,9)
Placing number 7 at (5,9)
Only one possibility for location (5,3)
Placing number 9 at (5,3)
Only one possibility for location (8,2)
Placing number 10 at (8,2)
Only one possibility for location (8,3)
Placing number 7 at (8,3)
Only one possibility for location (8,5)
Placing number 8 at (8,5)
Only one possibility for location (8,9)
Placing number 16 at (8,9)
Only one possibility for location (12,5)
Placing number 9 at (12,5)
Only one possibility for location (12,6)
Placing number 12 at (12,6)
Only one possibility for location (14,5)
Placing number 1 at (14,5)
Only one possibility for location (14,8)
Placing number 15 at (14,8)
Only one possibility for location (15,8)
Placing number 5 at (15,8)
Only one possibility for location (15,9)
Placing number 11 at (15,9)
Only one possibility for location (15,11)
Placing number 4 at (15,11)
Only one possibility for location (15,12)
Placing number 10 at (15,12)
Only one possibility for location (16,1)
Placing number 5 at (16,1)
Only one possibility for location (16,4)
Placing number 15 at (16,4)
Only one possibility for location (16,6)
Placing number 8 at (16,6)
Only one possibility for location (16,7)
Placing number 7 at (16,7)
Only one possibility for location (16,10)
Placing number 13 at (16,10)

_________________
Jaap
--
Jaap's Puzzle Page:
http://www.geocities.com/jaapsch/puzzles
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
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