Templates as patterns

Advanced methods and approaches for solving Sudoku puzzles

Re: Templates as patterns

Postby blue » Sun Oct 27, 2024 10:12 am

denis_berthier wrote:
blue wrote:But the reverse isn't always the case: that the extension of a template[k-1] by a compatible template[1] for a different number, is (still) a member of the relevant template[k] list. That was the point. I think you're being argumentative for no good reason.


I don't understand what you mean by "relevant list". If you mean that they are compatible with the grid data (i.e. the current resolution state), all the template[k] instantiations I ever consider are a priori compatible with the grid data - until they are eventually proven to be impossible.

For an example, if the template[k-1] item is in the list for digits {1,2}, and the "compatable template[1] item" is in the list for {9}, then the "relevant list" for the extension, is just the template[3] list for digits {1,2,9}.

denis_berthier wrote:
blue wrote:"Too many eliminations" ... you would think so, but the "no solution" problem hasn't come up, even for your list of 100 T3 puzzles.

So, considering our common results below, this suggests:
- either you have a bug and it is localised in your templates[4];
- or I miss some eliminations in T4 (I've already checked my code several times, but I'll do it again).

It's the other way around: my code never makes it to T4.
Either it deletes too much in T3, and by luck, it never deletes anything crucial; or your T3 "code" isn't deleting as much as it could/should.
blue
 
Posts: 1026
Joined: 11 March 2013

Re: Templates as patterns

Postby denis_berthier » Sun Oct 27, 2024 10:44 am

blue wrote:
denis_berthier wrote:
blue wrote:But the reverse isn't always the case: that the extension of a template[k-1] by a compatible template[1] for a different number, is (still) a member of the relevant template[k] list. That was the point. I think you're being argumentative for no good reason.

I don't understand what you mean by "relevant list". If you mean that they are compatible with the grid data (i.e. the current resolution state), all the template[k] instantiations I ever consider are a priori compatible with the grid data - until they are eventually proven to be impossible.

For an example, if the template[k-1] item is in the list for digits {1,2}, and the "compatable template[1] item" is in the list for {9}, then the "relevant list" for the extension, is just the template[3] list for digits {1,2,9}.

You're saying the same thing as me, in different words.


blue wrote:
denis_berthier wrote:
blue wrote:"Too many eliminations" ... you would think so, but the "no solution" problem hasn't come up, even for your list of 100 T3 puzzles.

So, considering our common results below, this suggests:
- either you have a bug and it is localised in your templates[4];
- or I miss some eliminations in T4 (I've already checked my code several times, but I'll do it again).

It's the other way around: my code never makes it to T4.
Either it deletes too much in T3, and by luck, it never deletes anything crucial; or your T3 "code" isn't deleting as much as it could/should.

Right. I've re-checked both the T3 and T4 rules, but I found no bug.

What are the puzzles in T4 (for me) that you have tested and found in your T3?
.
denis_berthier
2010 Supporter
 
Posts: 4140
Joined: 19 June 2007
Location: Paris

Re: Templates as patterns

Postby blue » Sun Oct 27, 2024 11:25 am

denis_berthier wrote:What are the puzzles in T4 (for me) that you have tested and found in your T3?


Code: Select all
1.......9.5....2....87...4.2...3......48.5....8.6...7...6..4.5.........1....9.3..  (ED 11.8 11.8 07.9) - referenced by P.O.
..3......4...8..36..8...1...4..6..73...9..........2..5..4.7..686........7..6..5..  eleven 6539 ("most templates")
1.......2.9.4...5...6...7...5.9.3.......7.......85..4.7.....6...3...9.8...2.....1  Easter Monster (T4 example)

......7..4....9...6.8..7.......1537.3.5.2..91...9.35.2...3.19.7.3.5..12..1...2.53  ;893;16198 #4956
..34.678...718..36....374.129..6....5........73....6.837..4.........3.......718.3  ;933;22275 #5067
..34.678...718..36....374.129..6....37....6.85........73..4.........3.......718.3  ;934;22276 #5074
.2345.78.4.7.8.2...8..........5.4.7.....6....7..91....3.5...4.78....532...2..3.58  ;1245;23134 #6120
.2..5.......1....6.8.73.....1........98...62...4...8.1.61..49..8.2...46..4...8.12  ;1247;29659 #6124
.2..5.......1....6...73.....1........98...62...4...8.1.61..49.88.2...46.94...8.12  ;1247;28794 #6125
12..56......1.92.6...23.1........5.1.4.......87...2.....2.9.36....3..9.2..962..15  ;1449;62715 #6696
1..45....4.71.9.......271.42.4...........16.8......3...4279..1.57..1..9.9.15.....  ;1451;62714 #6700
12.4.........8...6....731..2.45..96....9...1.91....5...4....62.59....4.16........  ;2317;298786 #9524


These were from a post by P.O..
I don't know if you've tested them or not, but I have them all in T3.
I was under the mistaken impression that you had them in T4 as well -- probably not though.

Code: Select all
"reported as 4"
12.3.....4.5...6...7.....2.6..1..3....453.........8..9...45.1.........8......2..7  patience
12.3....435....1....4........54..2..6...7.........8.9...31..5.......9.7.....6...8  red dwarf 

"reported as 5"
.......39.....1..5..3.5.8....8.9...6.7...2...1..4.......9.8..5..2....6..4..7.....  golden nugget
12.3.....4.....3....3.5......42..5......8...9.6...5.7...15..2......9..6......7..8  Kolk
..3..6.8....1..2......7...4..9..8.6..3..4...1.7.2.....3....5.....5...6..98.....5.  imam bayildi
1.......9..67...2..8....4......75.3...5..2....6.3......9....8..6...4...1..25...6.  eleven 5
12.4..3..3...1..5...6...1..7...9.....4.6.3.....3..2...5...8.7....7.....5.......98  discrepancy
12.3.....34....1....5......6.24..5......6..7......8..6..42..3......7...9.....9.8.  cigarette
.2..5.7..4..1....68....3...2....8..3.4..2.5.....6...1...2.9.....9......57.4...9..  cheese
........3..1..56...9..4..7......9.5.7.......8.5.4.2....8..2..9...35..1..6........  fata morgana

"reported as 6"
........7.2.4...6.1.....5...9...2.4....8..6..6..9.......5..3....3..8..2.7....4..1"  tungsten rod
.......12........3..23..4....18....5.6..7.8.......9.....85.....9...4.5..47...6..."  platinum blonde
..3......4...8..36..8...1...4..6..73...9..........2..5..4.7..686........7..6..5.."  eleven 6539 second strategy [ "most templates" again ]
1...5......7..9.3...9..754...4..3.7..6........9.8........79..2......24.3..2......"  eleven 2548 second strategy
1..4....9.56..9.......1..6..6....8..5....4.9.9....5.1..7....2..6....1.5....3....."  eleven 25832 second strategy
blue
 
Posts: 1026
Joined: 11 March 2013

Re: Templates as patterns

Postby denis_berthier » Sun Oct 27, 2024 11:41 am

Code: Select all
1.......9.5....2....87...4.2...3......48.5....8.6...7...6..4.5.........1....9.3..  (ED 11.8 11.8 07.9) - referenced by P.O.
..3......4...8..36..8...1...4..6..73...9..........2..5..4.7..686........7..6..5..  eleven 6539 ("most templates")
1.......2.9.4...5...6...7...5.9.3.......7.......85..4.7.....6...3...9.8...2.....1  Easter Monster (T4 example)

already tested, in T4


Code: Select all
......7..4....9...6.8..7.......1537.3.5.2..91...9.35.2...3.19.7.3.5..12..1...2.53  ;893;16198 #4956
..34.678...718..36....374.129..6....5........73....6.837..4.........3.......718.3  ;933;22275 #5067
..34.678...718..36....374.129..6....37....6.85........73..4.........3.......718.3  ;934;22276 #5074
.2345.78.4.7.8.2...8..........5.4.7.....6....7..91....3.5...4.78....532...2..3.58  ;1245;23134 #6120
.2..5.......1....6.8.73.....1........98...62...4...8.1.61..49..8.2...46..4...8.12  ;1247;29659 #6124
.2..5.......1....6...73.....1........98...62...4...8.1.61..49.88.2...46.94...8.12  ;1247;28794 #6125
12..56......1.92.6...23.1........5.1.4.......87...2.....2.9.36....3..9.2..962..15  ;1449;62715 #6696
1..45....4.71.9.......271.42.4...........16.8......3...4279..1.57..1..9.9.15.....  ;1451;62714 #6700
12.4.........8...6....731..2.45..96....9...1.91....5...4....62.59....4.16........  ;2317;298786 #9524
[/quote]

I don't know if I had tested part of this list before. But I find them all in T4 (easy ones in T4).


I had already tested your 2nd list: all in T4.
.
denis_berthier
2010 Supporter
 
Posts: 4140
Joined: 19 June 2007
Location: Paris

Re: Templates as patterns

Postby denis_berthier » Sun Oct 27, 2024 12:06 pm

denis_berthier wrote:
blue wrote:P.S.: For your "cbg-000" list, I get these results:
Code: Select all
T0 : 7489 (35.0%)
T1 : 3630 (17.0%)
T2 : 1916 ( 9.0%)
T3 : 8340 (39.0%)

That seems to be in line with your results for the larger list.

Same as me.


The more I think about it, the more it seems strange that we get the same results for 21,375 puzzles in T&E(1) but we find differences for harder puzzles.
Could you try a larger part of the cbg collection? (I've already done the computations for the 1st 254,760 puzzles.)
denis_berthier
2010 Supporter
 
Posts: 4140
Joined: 19 June 2007
Location: Paris

Re: Templates as patterns

Postby blue » Sun Oct 27, 2024 1:36 pm

Code: Select all
T0 : 89488 (35.13%)
T1 : 43551 (17.09%)
T2 : 22141 ( 8.69%)
T3 : 99580 (39.09%)

Yes, it's very strange.
blue
 
Posts: 1026
Joined: 11 March 2013

Re: Templates as patterns

Postby P.O. » Sun Oct 27, 2024 1:38 pm

eleven wrote:(...) What i would be interested in at the end is, if P.O.'s calculation for the k-template depths of tridagon puzzles are relatively low, too.

i made this observation
P.O.
 
Posts: 1686
Joined: 07 June 2021

Re: Templates as patterns

Postby denis_berthier » Sun Oct 27, 2024 2:50 pm

blue wrote:
Code: Select all
T0 : 89488 (35.13%)
T1 : 43551 (17.09%)
T2 : 22141 ( 8.69%)
T3 : 99580 (39.09%)

Yes, it's very strange.

All the more that we have the same results also for this very large list (254,760 puzzles).
It's hard to believe the differences for hard puzzles could come only from the T0 ... T3 rules.
When I activate only T0 ... T3 in the config file, rules in T4 are not loaded into Clips and can't interfere in any way. Do you also have a way to completely disable your code for rules deeper than T3?
.
denis_berthier
2010 Supporter
 
Posts: 4140
Joined: 19 June 2007
Location: Paris

Re: Templates as patterns

Postby eleven » Sun Oct 27, 2024 7:40 pm

P.O. wrote:i made this observation

Thanks. As expected.
eleven
 
Posts: 3136
Joined: 10 February 2008

Re: Templates as patterns

Postby blue » Sun Oct 27, 2024 8:09 pm

denis_berthier wrote:When I activate only T0 ... T3 in the config file, rules in T4 are not loaded into Clips and can't interfere in any way. Do you also have a way to completely disable your code for rules deeper than T3?

I added something to the code to make it exit with a "T4" message, if ever it found itself building a template[4] list, or trying to use one in a rule applciation, or removing an entry from a template[3] list in a rule application. It doesn't happen for any of the (26) puzzles that I listed.

I've also added detailed "sanity" checks to every phase of the code, now too, to make sure that template[k] lists are as full as they're supposed to be when they're first built, and that whenever anything is removed from one (in my streamlined code), it's for a valid reason (confirmed by detailed checks).

Everything checks out fine. The only oddity that I know of -vs- what you're doing with SudoRules, is that it can do several Tk-delete (or T1-assert) applications at once, before "downshifting" to level k-1. That shouldn't be an issue though.
blue
 
Posts: 1026
Joined: 11 March 2013

Re: Templates as patterns

Postby blue » Sun Oct 27, 2024 9:17 pm

denis_berthier wrote:Here's now something totally unexpected from computations that just finished running.

I tried a small collection of T&E(2) puzzles, namely the collection of 153 puzzles that I introduced as the standard T&E(2) examples for the SHC (see [HCCS2] and http://forum.enjoysudoku.com/the-sudoku-hierarchical-classifier-shc-t42075.html).
This collection has 10 puzzles for each value of BxB, except for B11B and B12B that had no known puzzles at that time and B13B that had only 3 known puzzles.

My first surprise was:
- whereas the collection is ordered by the increasing values of BxB, the first part of the puzzles is in T4 and the second part in T3 (template-depth varies in the inverse order).

And here comes my second surprise:
The split happens after the first 3 puzzles in B7B.
The puzzles in the first part of the list are old T&E(2) puzzles with no tridagon (including the only 3 old known ones in B7B); the puzzles in the second part are recent T&E(2) puzzles, all with a tridagon. It seems that the presence of a tridagon reduces the template-depth to 3 (regardless of the T&E-depth, if we take into account my previous calculations with the first few thousand puzzles in T&E(3) - all of which have a tridagon.

Hi Denis,

I've tried those too, now. I have them all in T3.
As you might expect, the puzzles at the end of the list were resolved more quickly than the ones at top.
blue
 
Posts: 1026
Joined: 11 March 2013

Re: Templates as patterns

Postby denis_berthier » Mon Oct 28, 2024 4:01 am

blue wrote: The only oddity that I know of -vs- what you're doing with SudoRules, is that it can do several Tk-delete (or T1-assert) applications at once, before "downshifting" to level k-1. That shouldn't be an issue though.

The worst it could do is delay some rules firing, but not allow more eliminations.

My "code" is just the transliteration of the logical rules in the Clips language. They are easy to check (and I've done it many times). It remains a mystery.
denis_berthier
2010 Supporter
 
Posts: 4140
Joined: 19 June 2007
Location: Paris

Re: Templates as patterns

Postby denis_berthier » Mon Oct 28, 2024 4:08 am

.
@Blue
Could you check the classifications you get for the 3 sets of puzzles defined here: http://forum.enjoysudoku.com/templates-as-patterns-t44896-28.html with respect to the restricted definition used by eleven/P.O. (if you have the relevant code)?
.
denis_berthier
2010 Supporter
 
Posts: 4140
Joined: 19 June 2007
Location: Paris

Re: Templates as patterns

Postby blue » Mon Oct 28, 2024 8:37 am

Code: Select all
1st 100
-------
level 1 : 100 (100.00%)

2nd 100
-------
level 2 : 100 (100.00%)

3rd 100
-------
level 3 :  82 (82.00%)
level 4 :  17 (17.00%)
level 5 :   1 ( 1.00%)
blue
 
Posts: 1026
Joined: 11 March 2013

Re: Templates as patterns

Postby P.O. » Mon Oct 28, 2024 9:10 am

@blue, i have the same distribution as you for the third:
Code: Select all
3tp: 82 : (2 3 4 5 6 7 8 9 12 13 14 15 16 17 18 19 20 22 24 25 26 27 28 29 30 31 32 33 35
           36 37 41 42 45 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 66 67 68 69
           70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 89 90 92 94 95 96 97 98 99 100)
 
4tp: 17 : (1 10 11 21 23 34 38 39 40 43 44 49 65 87 88 91 93)
 
5tp: 1  : (46)
P.O.
 
Posts: 1686
Joined: 07 June 2021

PreviousNext

Return to Advanced solving techniques