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   

Does the order the patterns (methods) are applied matter?

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

Joined: 18 Aug 2005
Posts: 35
:

Items
PostPosted: Fri Aug 19, 2005 9:01 am    Post subject: Does the order the patterns (methods) are applied matter? Reply with quote

Do most programs start out checking for one pattern/solving method and check all rows, columns and boxes for this method and then go on to the next method?

If so, is it best to start with the easiest methods first (candicates, subsets), or is it best to start with the difficult ones (swordfish, XY, X-wing) first? Does it matter?

Does using the easiest methods first restrict or enhance the ability to find a swordfish pattern later on?

Kranser.
Back to top
View user's profile Send private message
gaby

Joined: 02 Jul 2005
Posts: 120
:

Items
PostPosted: Thu Aug 25, 2005 10:14 am    Post subject: Reply with quote

My program starts by trying all the really simple techniques first, as they're the most benefit for the least execution time. Only when it gets stuck on those does it try the harder techniques. Some of the harder techniques involve recursive algorithms, so reducing the search space by a small amount can have a larage effect on the amount of processing required for a recursive method.

I haven't really done much testing involving putting the methods in different order, but I have them applied in order of algorithmic complexity. I think sacrificing the ability to identify a swordfish later on is offset by the ability to do a fast forcing chains analysis instead.

Perhaps some experimentation is in order...

Gaby
_________________
Free daily sudoku - Online puzzle database
http://vanhegan.net/sudoku/
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: Fri Aug 26, 2005 8:28 am    Post subject: Reply with quote

however, I assume that the techniques do commute ?!
(I haven't tried these yet)

or is it possible that some puzzle can be solved with some set of techniques
in one special order but cannot be solved when the
order of the techniques is changed ?


discarding some possible effects on the running time
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jbum

Joined: 14 Aug 2005
Posts: 14
:
Location: Los Angeles

Items
PostPosted: Sat Sep 24, 2005 6:16 am    Post subject: Reply with quote

It depends on what you're trying to accomplish. If you're trying to reproduce how a human might solve it, it is better to use simple to understand techniques before hard to understand techniques. I use this kind of system I am trying to understand whether a puzzle "requires" a particular technique, such as XY-Wing.

If you're trying to solve the puzzle quickly, it is better to use techniques that solve patterns that have a statistically high likelihood of occuring, and which are more efficient, first.

So while a human might look for X-Wing first, it is more effective to look for XY-Wing or Turbo-fish first, since these occur more often.
_________________
http://www.krazydad.com/


Last edited by jbum on Sat Sep 24, 2005 4:36 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Ruud
Site Admin
Joined: 17 Sep 2005
Posts: 708
:
Location: Netherlands

Items
PostPosted: Sat Sep 24, 2005 12:20 pm    Post subject: Reply with quote

For me. the following sequence works best:

1. Eliminate candidates blocked by an entry.
2. Update hashes and counters for cells, rows, columns and boxes.
3. Use the counters to detect naked and hidden singles.
4. Check the minirows and minicolumns for locked pairs and triples.
5. Check the r/c/b hashes for naked and hidden subsets.

All additional blocks from 3, 4 and 5 are placed on a queue.

6. Process the queue and repeat 2 through 6 until the queue is empty.
7. Check for advanced patterns (X-Wing, Swordfish, remote pairs, etc)
8. For each pattern found, put eliminated candidates on the queue (goto 6)

When queue is empty, no more patterns found, puzzle not yet solved:

9. Use coloring, forced chains, templates (see specific topic)
(again, all results from this step are queued)

Still no solved puzzle?

10. Use the selected brute-force solver. There are currently 4 built in my program:
- Trial & Error (slow but very human)
- Dancing Links (extremely fast and elusive)
- Template comparison (little slower, but able to reveal relationships between eliminated candidates and the cells that cause it)
- Recursive rows (a technique that works on a row-by-row basis, similar to dancing links, but without the requirement of the specific columns & rows. it works on the data structures already in place for other techniques)

11. Hide all these results and let the user solve the puzzle himself Smile
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