Templates as patterns

Advanced methods and approaches for solving Sudoku puzzles

Re: Templates as patterns

Postby blue » Thu Nov 21, 2024 8:06 am

denis_berthier wrote:OK for 1. and 2. (obvious)
But 3. is not proven.

OK, so: if 1r1c1 hasn't been asserted as a hidden single, then there are one or more additional cells in r1 (for example), with candidates for '1'.
From (2), T1-delete, allows each of those candidates to be eliminted, leaving a hidden single in r1.
blue
 
Posts: 1096
Joined: 11 March 2013

Re: Templates as patterns

Postby denis_berthier » Thu Nov 21, 2024 8:15 am

.
OK. That's the missing piece.
So, finally, template-depth 1 isn't an exception and T1bis is as strong as T1.
.
denis_berthier
2010 Supporter
 
Posts: 4648
Joined: 19 June 2007
Location: Paris

Re: Templates as patterns

Postby denis_berthier » Fri Jan 03, 2025 4:16 am

.
Happy New Year to all.

Generally speaking, 17-clue puzzles are among the easiest (in the mean) to solve with the usual resolution rules; but they are among the hardest (still in the mean) to solve with templates; they have easy puzzles with very large numbers of templates.

You might think that this is not unexpected because a small number of clues should imply a larger number of candidates (and therefore supposedly a larger number of templates *). And this is indeed true at the start, as I showed in [HCCS2, Table 3.1]. But, as also shown in [HCCS2, Table 3.2], the situation is more contrasted after BRT ("after Singles"). Excluding 17c puzzles solvable in BRT:
- there are more candidates in the mean (153.3) than for the controlled-bias collection (129.6);
- there are fewer candidates in the mean (153.3) than for the old T&E(2) collections (eleven = 205.7, ph2010 = 234.4);
- there are fewer candidates in the mean (153.3) than in mith's T&E(3) collection (169.7) (in which no puzzle has template-depth >3).

I even found a few puzzles with large numbers of templates, but with very low SER:

Code: Select all
.......719......6..2.........4.7.....3....4.....91....7..6....8...3..2..1........ ED=4.4/1.2/1.2
.......81.6.5.....7........2..6..5....8....2.1..3......4..21....5....6........... ED=2.6/1.2/1.2
......1.3.8..2.........45...3.....2....5...7....1.....1..3..6..7...8......5...... ED=3.4/1.2/1.2
......1.5..4.7..........3..15.3........6...8..2...........512....6....7.8........ ED=2.0/1.2/1.2
......1.94...5........2.3.....1.9...5....7......3......13.......8.....4...9....2. ED=4.5/1.2/1.2


(*) this supposition is indeed false, as previously mentioned: there's no general correlation between the number of candidates after BRT and the template-depth of a puzzle.
.
denis_berthier
2010 Supporter
 
Posts: 4648
Joined: 19 June 2007
Location: Paris

Re: Templates as patterns

Postby denis_berthier » Sat Nov 22, 2025 5:42 am

.
Following my post in the tridagon thread: http://forum.enjoysudoku.com/the-tridagon-rule-t39859-125.html, a friend asked me: can this be used in any way for solving by templates?

I don't think so.
My version of templates is pattern-based (but with a non standard use of patterns) and is compatible with using any other resolution rules - i.e. you can mix any resolution rules and templates in order to get a solution. But:
- will using the no-tridagon-in-solution pattern to eliminate a priori some templates make the template solution faster? I didn't try but I don't think so, though it may happen occasionally. Anyway, if speed of finding a solution is the purpose, templates are not the right method.
- will it provide a "nicer" template solution. I don't think so either. Templates are not interesting as a human solver method, except in exceptional cases. Using the no-tridagon-in-solution pattern may add a few such cases. (But anyway template-depth isn't related in any way to the other usual measures of difficulty of a puzzle. The hardest puzzles (template-wise) only need 4-digit templates, in very rare cases.) In the general case, any template that would be eliminated by the no-tridagon-in-solution pattern will be eliminated by the Sudoku constraints expressed as templates.
One question that arises if one tries to use the no-tridagon-in-solution 3-digit pattern in conjunction with templates is, where to put it in the hierarchy of complexity wrt to templates: the natural answer is between T2 and T3 or to include it in the T3 generation rules in order to block T3-templates before they can be generated, but nothing forbids to grant all the tridagon rules higher priority (which is the case with the standard SudoRules saliences).

Then, you may ask, what's the use of the no-tridagon-in-solution result? I think it stands by itself, as a complementary view of tridagons. Also, as a guard against looking for tridagons in solution grids.
.
denis_berthier
2010 Supporter
 
Posts: 4648
Joined: 19 June 2007
Location: Paris

Re: Templates as patterns

Postby denis_berthier » Sat Dec 27, 2025 10:45 am

Following several questions in other threads and irrelevant answers to them, let me recall this old post:
denis_berthier, 29 Oct 2024 wrote:So, finally, we have three different techniques for templates, based on equivalent definitions of a template[k]:
- the strongest one, introduced at the start of this thread;
- the old one, used by eleven and P.O.;
- the weakest one, defined while I tried to understand the latter.

In the three approaches, templates[1] eliminate candidates.
As for templates[k+1], k≥1:
- in the weakest approach, they can only eliminate candidates;
- in the medium approach, they can only eliminate templates[1]; (my cbg-000 results a few posts above show this is strictly stronger than the weakest approach, already at level T2);
- in the strongest approach, they can only eliminate templates[k].

The reasons for increasing power should be clear. Once level k+1 is reached and all the templates[k+1] are computed (which all the approaches must do):
- the weak approach can do nothing if it can't directly eliminate a candidate;
- the medium approach can do nothing if it can't directly eliminate a template[1] (which is easier than eliminating a candidate);
- the strong approach will not directly eliminate more candidates or templates[1], but is has a chance of eliminating templates[k], which may later lead to still more eliminations of smaller templates.


Note that this has absolutely nothing to do with "implementation". The differences are at the abstract logical level: different elimination rules.
.
denis_berthier
2010 Supporter
 
Posts: 4648
Joined: 19 June 2007
Location: Paris

Re: Templates as patterns

Postby StrmCkr » Tue Dec 30, 2025 9:36 am

deleted.
Last edited by StrmCkr on Wed Dec 31, 2025 9:06 am, edited 1 time in total.
Some do, some teach, the rest look it up.
stormdoku
User avatar
StrmCkr
 
Posts: 1492
Joined: 05 September 2006

Re: Templates as patterns

Postby denis_berthier » Tue Dec 30, 2025 11:28 am

StrmCkr wrote:does this sound like what you are doing ?

Your rule Tk-delete dynamical seems to be weaker (it's what I called the intermediary version).

First thing to check: take the examples in the first page of this thread. Do you find any with Template-depth > 4 ?
denis_berthier
2010 Supporter
 
Posts: 4648
Joined: 19 June 2007
Location: Paris

Re: Templates as patterns

Postby StrmCkr » Wed Dec 31, 2025 1:39 am

deleted.
Last edited by StrmCkr on Wed Dec 31, 2025 9:06 am, edited 1 time in total.
Some do, some teach, the rest look it up.
stormdoku
User avatar
StrmCkr
 
Posts: 1492
Joined: 05 September 2006

Re: Templates as patterns

Postby denis_berthier » Wed Dec 31, 2025 7:23 am

.
My purpose in choosing CLIPS for the implementation of CSP-Rules was to have an implementation as close as possible to the logical rules ("the rules are the code") and to avoid having to deal with implementation details you're talking of.
My rule Tk-delete is perfectly clear; it requires to keep track "dynamically" not only of 1-templates but of all the k'-templates for k' ≤ k.
.
denis_berthier
2010 Supporter
 
Posts: 4648
Joined: 19 June 2007
Location: Paris

Previous

Return to Advanced solving techniques