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   

Comparison of 5 fast solvers
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Programming sudoku
View previous topic :: View next topic  
Author Message
sudoking

Joined: 20 Oct 2009
Posts: 40
:

Items
PostPosted: Tue Oct 20, 2009 10:59 am    Post subject: Reply with quote

Here's the example I spoke of earlier, from sudocoo.c (I would post the whole code, but I'm modified it that much to suit the needs of my program, it no longer resembles the original):

Code:

level = 0;
...
if (m < 10) {
   try[level+1].candidates = z;
   try[level+1].cell = try[k].free;
   if (k != level) {
      j = try[level].free;
      try[level].free = try[k].free;
      try[k].free = j;
   }
   level++;
}


This code isn't as efficient as it could be. Every time try[] is accessed, the processor has to perform an indexed lookup, which isn't as fact as a non-indexed lookup. Here's my replacement.

Code:

register Try_t *tlevel, *tk;
...
tlevel = tryx;
...
if (m <10>candidates = z;
   (tlevel + 1)->cell = tk->free;
   if (tk != tlevel) {
      j = tlevel->free;
      tlevel->free = tk->free;
      tk->free = j;
   }
   tlevel++;
}


in this example, tlevel is a pointer that points to the same element referenced by try[level] in the first example. tk is a pointer which references try[k] from the first example. Using this kind of manual optimisation, I've been able to increase the performance of these algorithms by about 8%, depending on the puzzles tested.

Next, I'll be looking at the BB_Sudoku algorithm, which I've only just got my hands on.
Back to top
View user's profile Send private message
dobrichev

Joined: 18 Dec 2009
Posts: 28
:

Items
PostPosted: Sun Dec 20, 2009 6:27 pm    Post subject: Top 50000 Collection Reply with quote

Hello,

Quote:

PUZZLE COLLECTIONS USED:
------------------------

Top 50000 - .../top50000.zip
A collection by Ruud of 50,000 hardish puzzles
...

This collection must be used with some reservations. Some of the puzzles contain redundant digits. An example is
010000090009400100060000003000720504000168000207034000400000010008001700090000020 where the 51-th digit "4" should be removed.
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
Goto page Previous  1, 2
Page 2 of 2

 
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