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   

Error Chains (new solve technique?)
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku
View previous topic :: View next topic  
Author Message
Graeme

Joined: 31 Jan 2006
Posts: 22
:
Location: Adelaide

Items
PostPosted: Sun Feb 05, 2006 10:03 am    Post subject: Reply with quote

Here are two examples of my Error Chain technique.

If placement of a candidate value removes all candidates from another cell, that candidate value can be removed.



If the candidate value in blue is set, then all candidates are removed from the cell shaded blue. So we can remove the {6} and {4} candidates in the cells shaded yellow.


Last edited by Graeme on Sun Feb 05, 2006 12:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
Henk

Joined: 13 Nov 2005
Posts: 105
:

Items
PostPosted: Sun Feb 05, 2006 11:29 am    Post subject: Reply with quote

The examples you just shown look a lot like Forcing Chains. The one on the top left is just plain forcing chains, a dual implications chain. The other example also is forcing chains, a triple implications chain.

I'm currious about your implementation of these techniques. And the visualisation you shown, is that coming from your program, or is it a hand-painted?

As you show it here, it is not backtracking.
_________________
Generate and solve Sudoku puzzles with Into Sudoku!
Back to top
View user's profile Send private message
Graeme

Joined: 31 Jan 2006
Posts: 22
:
Location: Adelaide

Items
PostPosted: Sun Feb 05, 2006 11:58 am    Post subject: Reply with quote

Hi again, Henk.

No, Error Chains are nothing like Forcing Chains at all. (the caps below are to highlight the differences; I'm not shouting) Smile

Forcing Chains test EVERY candidate in a cell to determine if a certain value is set* in another cell regardless of initial candidate choice. Furthermore, Forcing Chains set that value in the OTHER cell.

Error Chains test ONE candidate to see if it removes all candidates from another cell. If it does, then it removes the candidate from the INITIAL cell.

* btw, Angus includes "if a candidate is removed from another cell regardless of initial candidate choice" in his definition of Forcing Chains. Even with this addition, the candidate value is still removed from the other cell, and not from the initial cell, like Error Chains.

And sorry, that pic is just a mock-up in PowerPoint.
Back to top
View user's profile Send private message
Henk

Joined: 13 Nov 2005
Posts: 105
:

Items
PostPosted: Sun Feb 05, 2006 12:59 pm    Post subject: Reply with quote

Quote:
Forcing Chains test EVERY candidate in a cell to determine if a certain value is set* in another cell regardless of initial candidate choice. Furthermore, Forcing Chains set that value in the OTHER cell.


True, but in my oppinion, this does not make a real difference. Your error chains looks like exactly the opposite of forcing chains. My implementation of forcing chains does what you just draws, but then inverts the logic again to make a forcing chain. I'm sure there are some differences in the details, but the pinciples are very much the same.

My conclusion:
Error chains / forcing chains has the same differences as a hidden subset / naked subset. When there is an forcing chain, there also is an error chain.

I might be wrong, just trying to make an understandment.

http://www.intosudoku.com/Doc/ForcingChain.html

BTW:
If you want to make more of these examples, you can use my program. You can start with an empty puzzle, and then fill in some candidates and you can even color the cells. You only need to draw the arrows yourself.
_________________
Generate and solve Sudoku puzzles with Into Sudoku!
Back to top
View user's profile Send private message
Graeme

Joined: 31 Jan 2006
Posts: 22
:
Location: Adelaide

Items
PostPosted: Sun Feb 05, 2006 1:32 pm    Post subject: Reply with quote

Henk, I think your link shows two good examples of Forcing Chains - one shows where a value is set in another cell regardless of initial candidate choice in the test cell, and the other shows where a candidate value is removed in another cell regardless of candidate choice in the test cell.

Of course, Forcing Chains are not restricted to test cells (AB in your diagrams) with just 2 candidate values, they could have all 9 possibilities for a 9 way implication chain!

I'm obviously not explaining myself clearly, so I'll try a different approach:

Error Chains and Forcing Chains and Nishio have these steps in common:
(1) Set a candidate value
(2) Set naked singles and remove candidates in the same groups
(3) Look for a condidtion
(4) Take an action if condition (3) exists

And here are the differences:

(1) Set a candidate value
Error Chains place a single candidate value
Forcing Chains place each candidate value one at a time, and repeat steps (1) to (3) for every candidate, before progressing to step (4)

(2) Set naked singles and remove candidates in the same groups
No difference here

(3) Look for a condidtion
Error Chains look for another cell with no candidates
Forcing Chains, after testing each candidate, look for another cell that has the same value set (or the same candidate removed) for every different candidate value set in step (1)

(4) Take an action if condition (3) exists
Error Chains remove the candidate from the cell in step (1)
Forcing Chains set the forced value (or removed candidate) from the cell in step (3)

I hope this shows more clearly that Error Chains and Forcing Chains are completely different things.
Back to top
View user's profile Send private message
Graeme

Joined: 31 Jan 2006
Posts: 22
:
Location: Adelaide

Items
PostPosted: Sun Feb 05, 2006 2:02 pm    Post subject: Reply with quote

And a couple of other points from your last post, Henk:

Yes, the simple (pairs only) example of Error Chains does work like forcing chains in reverse, but the other example shows why this doesn't always work.

And thanks for the offer of using you program for screen captures. I'm designing my own of course, so I'll probably use that for my own help screens.

regards,
Graeme
Back to top
View user's profile Send private message
Henk

Joined: 13 Nov 2005
Posts: 105
:

Items
PostPosted: Mon Feb 06, 2006 8:47 pm    Post subject: Reply with quote

Quote:
Of course, Forcing Chains are not restricted to test cells (AB in your diagrams) with just 2 candidate values, they could have all 9 possibilities for a 9 way implication chain!


Of course! I implemented these as well. Its not im the current release yet, but thats just because its needs to be tweaked in performance.



I understand you a little better. I'm still sceptic though, but it looks like you know where you are talking about. I'm curious about your solver, i hope you will post it here when its done..
_________________
Generate and solve Sudoku puzzles with Into Sudoku!
Back to top
View user's profile Send private message
gsf

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

Items
PostPosted: Mon Feb 06, 2006 9:08 pm    Post subject: Reply with quote

Henk wrote:
Graeme wrote:
Of course, Forcing Chains are not restricted to test cells (AB in your diagrams) with just 2 candidate values, they could have all 9 possibilities for a 9 way implication chain!

Of course! I implemented these as well. Its not im the current release yet, but thats just because its needs to be tweaked in performance.

I still can't distinguish forcing chains from guessing
at the point where a solver determines "time to use forcing chains"
what criteria determines what (chain endpoint) cells to check first?
is there any characteristic or pattern or any kind of hint?
Back to top
View user's profile Send private message Visit poster's website
tarek

Joined: 31 Dec 2005
Posts: 153
:
Location: London, UK

Items
PostPosted: Tue Feb 07, 2006 11:24 am    Post subject: Reply with quote

I would put any method that uses conradiction to eliminate candidates(The method mentioned in this thread, subtypes of the forcing chains, subtypes of colouring, Nishio,........) closer to The Pure guessing end of the solution.......

I would exhaust all non-(contradiction elimination methods) before resorting to these methods.

They all employ logic (even Pure guessing), however using contradiction puts things in the grey zone next to T&E (Not saying that they are) & therefore avoided until necessary.

Tarek
Back to top
View user's profile Send private message
Graeme

Joined: 31 Jan 2006
Posts: 22
:
Location: Adelaide

Items
PostPosted: Tue Feb 07, 2006 1:28 pm    Post subject: Reply with quote

Hi gsf & tarek,

IMHO, in order of least guesses to most ...

Nishio and Error Chains require guessing of one candidate at a time, in one cell at a time, to see if the required condition is met

XY-Chains require guessing one candidate at a time, in 2 cells at a time (to see if the chain works both ways, to allow candidate reduction in intersecting cells)

Forcing Chains required guessing every candidate in one cell at a time, to see if every guess candidate leads to a common outcome in a forced cell

And of course brute force trial & error allows unlimited guessing to find a solution, or not.

Quote:
gsf wrote: what criteria determines what (chain endpoint) cells to check first?


I've programmed my solver to test implications of guesses by setting naked singles only, because that's how I think most humans would use these techniques. But you could run the entire set of solve techniques to test guess implications if you wanted to, but I doubt many human solvers would do that. Specially not with multiple scenarios like XY-Chains and Forcing Chains.
Back to top
View user's profile Send private message
tarek

Joined: 31 Dec 2005
Posts: 153
:
Location: London, UK

Items
PostPosted: Tue Feb 07, 2006 3:11 pm    Post subject: Reply with quote

Graeme wrote:
IMHO, in order of least guesses to most ...

Nishio and Error Chains require guessing of one candidate at a time, in one cell at a time, to see if the required condition is met

XY-Chains require guessing one candidate at a time, in 2 cells at a time (to see if the chain works both ways, to allow candidate reduction in intersecting cells)

Forcing Chains required guessing every candidate in one cell at a time, to see if every guess candidate leads to a common outcome in a forced cell

And of course brute force trial & error allows unlimited guessing to find a solution, or not.


My perspective to this issue is different, it is "how you prove your conclusion" is what decides how close it is to guessing.

implication chains/nets that do not contain a contradiction elimination are fine by me (the same goes for XY chains)... it is not the systematic process by which your program reached to the CORRECT path but "the path itself " having a contradiction elimination or not.


tarek
Back to top
View user's profile Send private message
gsf

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

Items
PostPosted: Tue Feb 07, 2006 3:54 pm    Post subject: Reply with quote

Graeme wrote:

IMHO, in order of least guesses to most ...

this is also the simplest backtrack solver ordering
Graeme wrote:

XY-Chains require guessing one candidate at a time, in 2 cells at a time (to see if the chain works both ways, to allow candidate reduction in intersecting cells)

a chain leading to intersecting cells is cycle detection
once cycles have been isolated there is no guessing
elimination (or lack of elimination) falls out as a property of the cycle
(even/odd # links, weak/strong segments)
just like eliminations fall out when a swordfish pattern is isolated

one could argue that looking for swordfish or xy cycles involves guessing
but looking for patterns, which does not involve temporary candidate placement,
is fundamentally different from guessing candidate assignments
and following the implications

it seems that a simple backtrack solver is the universal implication by
contradiction algorithm -- all that is needed is a trace of backtrack
failures, in whatever cycle/chain notation, to illustrate the implication
path to solution

this also brings into question some of the chain puzzle solutions posted on the forums
a solver, human or computer, should list the number of non-productive chains,
or maybe non-productive candidate guesses, made before the right candidate
guesses were made on the right candidate cell, which then
lead to the final solution chain(s)

if hiding non-productive guesses is acceptable then,
since almost all of the puzzles requiring "contradiction chaining"
posted on the forums have at least 1 backdoor of size 1, there exists an
algorithm to trivially solve each of these puzzles
with a chain of length 1: rAcB=V => trivial solution

no matter what its called:
saving state + making guesses + propagating implications + restoring state == backtracking
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: Tue Feb 07, 2006 6:29 pm    Post subject: Reply with quote

From time to time, the old Logic vs. Guessing/T&E debate flames up again. I like the arguments, but to me it is a trivial debate.

A backdoor (Magic Cell we used to call it) has the same validity as a lucky guess. When it leads to a solution, it only proves there is a solution, not that there is only one solution.

However, a commonly used pattern recognition technique, Uniqueness Test and the lesser known BUG are based on the same principle.

When a single solution is presumed, any technique that finds it and which is based on this premise, is rooted in logic, whether it is a pattern recognition routine, a simple guess or a thorough search algorithm.

With the Nightmare players, who discuss them on the SudoCue forum, the uniqueness discussion is more important than the T&E vs. logic discussion. There are some players who refuse to use these techniques, others can't get enough of it.

On a separate note, we should not compare our programs too much with the pencil-and-paper guys. First, when they're visiting these forums, they're not entirely pencil-and-paper guys, are they? I've seen some die-hard manual solvers asking questions about how to use some features of a certain piece of software that I shall not name here, but it can be found in my signature...

Nevertheless, with the available tools, they do discover and develop new solving techniques, replacing N^4 algorithms with easier patterns with a more difficult name.

But we're pleasing a very small crowd here. The majority of players want easier sudokus, not more difficult. I had to use negative ratings to be able to add easier sudokus, which they will solve only by guessing. And they're having fun with it. For me, that's the most important part.

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

Joined: 13 Nov 2005
Posts: 105
:

Items
PostPosted: Tue Feb 07, 2006 8:10 pm    Post subject: Reply with quote

Amen ruud!

Quote:
The majority of players want easier sudokus, not more difficult


I too had to improve my generator to generate easier Sudoku's because a lot of players want to start with very easy puzzles and will never play one with more then 3 stars....
_________________
Generate and solve Sudoku puzzles with Into Sudoku!
Back to top
View user's profile Send private message
gsf

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

Items
PostPosted: Tue Feb 07, 2006 11:28 pm    Post subject: Reply with quote

Ruud wrote:
From time to time, the old Logic vs. Guessing/T&E debate flames up again. I like the arguments, but to me it is a trivial debate.

A backdoor (Magic Cell we used to call it) has the same validity as a lucky guess. When it leads to a solution, it only proves there is a solution, not that there is only one solution.

backdoor comes from the constraint satisfaction community and was
coined before magic cell, but learned of after magic cell was coined
http://www.setbb.com/sudoku/viewtopic.php?t=248&highlight=&mforum=sudoku

I would just like to see methods that rely on guessing to say so up front
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  Next
Page 2 of 3

 
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