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   

Colouring Troubleshooting
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku
View previous topic :: View next topic  
Author Message
gaby

Joined: 02 Jul 2005
Posts: 120
:

Items
PostPosted: Mon Oct 17, 2005 9:50 pm    Post subject: Reply with quote

Ruud, the missing conjugate in box 3 isn't coloured because it doesn't intersect in any way with any of the other conjugates. Should I make it colour every conjugate in the set?
_________________
Free daily sudoku - Online puzzle database
http://vanhegan.net/sudoku/
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: Mon Oct 17, 2005 10:07 pm    Post subject: Reply with quote

Quote:
And suggests removing the dark yellow numbers. Something is not quite right here. Is this a special case? All the other puzzles in the stress testing set got solved fine, most of them with colouring, some without. Where's the error?

Good fortune smiles at you Smile

Your program has discovered an inconsistency in the dark yellow colors. Quite rightly it suggests that you should get rid of them.

Quote:
Ruud, the missing conjugate in box 3 isn't coloured because it doesn't intersect in any way with any of the other conjugates. Should I make it colour every conjugate in the set?


Normally, you would color every conjugate pair. My solver does color every pair, because it does not look in advance whether it can be linked to another pair. If you leave out these checks, you may end up with a few useless colors, but the routine would be a lot faster.
Back to top
View user's profile Send private message Visit poster's website
Lummox JR

Joined: 07 Sep 2005
Posts: 202
:

Items
PostPosted: Mon Oct 17, 2005 11:16 pm    Post subject: Reply with quote

Quote:
Normally, you would color every conjugate pair. My solver does color every pair, because it does not look in advance whether it can be linked to another pair. If you leave out these checks, you may end up with a few useless colors, but the routine would be a lot faster.

Considering there's no way of knowing in advance if there's another pair to link to until you've colored them all, I don't think it's at all possible to decide whether a color will be useless until they're all present. Useless colors don't harm anything, though.
Back to top
View user's profile Send private message
Lummox JR

Joined: 07 Sep 2005
Posts: 202
:

Items
PostPosted: Mon Oct 17, 2005 11:37 pm    Post subject: Reply with quote

Ruud, I'd been meaning to get back to this post from yesterday, since it's got an interesting insight:
Ruud wrote:
In the next diagram, you see the candidates for digit 7, with colors:
Code:
* * .|* . .|. * .
* . *|. * .|* * .
. . .|* . .|* * .
-----+-----+-----
. . .|. . .|. . .
. A a|. . .|. . .
. . .|. . .|. . .
-----+-----+-----
. B .|b . .|. . .
. * *|. * .|* * .
* * *|. * .|* * .

Now the colouring routine could not draw any conclusions, but the template checker decided to eliminate r2c3. And.... I totally agree with it.

This is the proof: A!B, so either a or b (or both) must be true. When a=true, r2c3 is eliminated. When b=true, r1c4 and r3c4 are eliminated, exposing r2c5 as a single in box 2. The remaining candidates in row 2 will be eliminated, including our victim r2c3.

I've mentioned a couple of similar situations on this forum, but haven't got a lot of feedback. It seems to me that we should not only look at the shared peers of a and b, but also look at the eliminations caused by any of those 2 colors to be true.

This situation actually goes beyond coloring and requires a different type of logic. Nick70 has suggested that if all candidates are assigned a color even though they have no conjugates, and if you use each set of them in which one must be true to develop sets that are conjugates of other sets, you can extend supercoloring to the point where it's equivalent to bifurcating chains or tabling. This is an equivalent in one digit, i.e. simple coloring vs. supercoloring. Doing this by extended supercoloring though is equivalent to dropping a piano on your head.

What you've got here is actually a single-digit case of a bifurcating implication chain. The premise of this chain is that (3,2)<>7. From there you can use the logic of bifurcating chains to label the graph as follows, where all lowercase letters support the premise when their candidate is false, and all uppercase letters support it when true.
Code:
B B .|* . .|. * .
B . a|. B .|B B .
. . .|* . .|* * .
-----+-----+-----
. . .|. . .|. . .
. b B|. . .|. . .
. . .|. . .|. . .
-----+-----+-----
. C .|c . .|. . .
. C B|. c .|* * .
b C B|. C .|C C .

There are two c's in box 8. Conclusion: (4,7)<>7 and (5,8)<>7 both prove that (3,2)<>7. One of those must be true, because the 7 can't be in both, so (3,2)<>7.

I can, however, see the point of at least trying to place extra colors by process of elimination like this. If you see that b eliminates the rest of box 2, naturally (5,2) must also be b. However this implication only works one way: (4,7)=7 -> (5,2)=7. To properly place the b, you must also observe that (5,2)=7 -> (4,7)=7, which in this case is true. If you can prove that one being true proves the other is true, and vice-versa, you can label the cells with the same color. I'd definitely call this extended coloring, though, and wouldn't recommend it for general use because it's harder to see all the implications involved.
Back to top
View user's profile Send private message
Ruud
Site Admin
Joined: 17 Sep 2005
Posts: 708
:
Location: Netherlands

Items
PostPosted: Tue Oct 18, 2005 1:27 am    Post subject: Reply with quote

Thanks for the feedback.

I brought this up because I wanted to see how far I could go to bring the coloring technique upto the same level as the template checker. Since the latter does not know what other digits are involved, the conclusions it draws must be solely based upon the distribution of cells that allow that digit (btw I call them vacancies in my program, in line with candidates for digits that can fill them)

Now since I've dug a little deeper into coloring, the eliminations made by the template checker make a lot more sense to me. Where coloring stops at the intersections, I can go just a little further and see how it has come to those eliminations.

To stay within the same effective range as the template checker, I cannot add any logic that would include other digits, so I would have to stick to hidden singles (single vacancies sounds better) and vacancies locked in line-box intersections (pointing pairs). As you suggested, a spare set of colors could be used to perform these "what if a were true" and "what if b were true" scenarios.

I still consider this logic, because the premise is simple: either a or b contains that digit. It's just how far you are willing to go extrapolating from that premise.

Another issue, now I've got your attention, has been haunting me the last couple of days, and I would appreciate some feedback.

My solver, like probably most other solvers, will take care of an XY-Wing by eliminating the Z-digit from the peers shared by the XZ and YZ cells.

A more interesting approach would be to consider XZ and YZ a conjugate pair for the Z digit. The solver has an excellent tool to exploit conjugate pairs to the max: multicoloring. Even if the pair would not eliminate any candidates by itself, it can still be used in a coloring scheme.

It is certainly not hard to implement. I already have a method that hunts XY-wings. The only thing I need to change is not to draw conclusions immediately, but to add the XZ and YZ cells as an extra conjugate pair to coloring. The coloring method would deal with the immediate eliminations, but can also link it to other pairs, make exclusions, etc.

Actually, this idea excites me even more than extended coloring.

Ruud.
Back to top
View user's profile Send private message Visit poster's website
gaby

Joined: 02 Jul 2005
Posts: 120
:

Items
PostPosted: Tue Oct 18, 2005 10:04 am    Post subject: Reply with quote

I nailed the problem in the end. It was a hangover from the colour contradiction detection. Previously it scanned for all light coloured clashses and all dark coloured clashes, and it was changed to work on a single colour at a time, but I hadn't changed the candidate removal part of that system, so it was still removing all of the dark colours, not just the dark yellow colours. Now 'tis fixed. Just have to make it colour the rest of the conjugates, to see what happens.
_________________
Free daily sudoku - Online puzzle database
http://vanhegan.net/sudoku/
Back to top
View user's profile Send private message Visit poster's website
Nick70

Joined: 08 Jun 2005
Posts: 160
:

Items
PostPosted: Tue Oct 18, 2005 12:11 pm    Post subject: Reply with quote

Ruud wrote:
In the next diagram, you see the candidates for digit 7, with colors:
Code:
* * .|* . .|. * .
* . *|. * .|* * .
. . .|* . .|* * .
-----+-----+-----
. . .|. . .|. . .
. A a|. . .|. . .
. . .|. . .|. . .
-----+-----+-----
. B .|b . .|. . .
. * *|. * .|* * .
* * *|. * .|* * .

Now the colouring routine could not draw any conclusions, but the template checker decided to eliminate r2c3. And.... I totally agree with it.


Let me add some more colors.
Code:
* * .|D . .|. * .
P . Q|. E .|R S .
. . .|C . .|* * .
-----+-----+-----
. . .|. . .|. . .
. A a|. . .|. . .
. . .|. . .|. . .
-----+-----+-----
. B .|b . .|. . .
. * *|. * .|* * .
* * *|. * .|* * .

C,D,E are all the colors in box 2. C|b, and D|b, therefore for every x such that x|E we have x|b. So:
P|b, Q|b, R|b, S|b.

Also, Q|a and A|B, so Q|B.

Finally Q|B and b|Q, so Q|Q therefore Q is false.
Back to top
View user's profile Send private message
Lummox JR

Joined: 07 Sep 2005
Posts: 202
:

Items
PostPosted: Tue Oct 18, 2005 5:32 pm    Post subject: Reply with quote

Indeed, when using the color set system you have conjugates b!{CD} and E!{CD}, hence b=E. When using extended colors in this way, this simple rule will do:

If a color or set of colors A is the conjugate of two other colors or sets B and C, B=C. If B is a color and C a set, one and only one of C's members is true if B is true, and vice-versa; if B is false, none of C's members are true, and vice-versa. If B and C are both sets, either they will each have one true member or their members will all be false.
Back to top
View user's profile Send private message
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
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