## Subsets in SudoRules

Programs which generate, solve, and analyze Sudoku puzzles

### Subsets in SudoRules

Subsets in SudoRules
In the general paradigm of CSP-Rules and its SudoRules application, each time a candidate is eliminated, the simplest available rule is chosen for the next step and applied. As a result, some patterns that allow multiple eliminations may be interrupted by a simpler rule after only part of these eliminations have been effected. This typically happens with Subsets.

As a nicety leading to shorter and more readable resolution paths, I have introduced a new option in SudoRules, allowing a Subset (Naked, Hidden or Super-Hidden, and also Finned Fish) to suspend the application of all the other rules and to eliminate all its targets at once.
If a resolution theory (a set of resolution rules) chosen for solving a puzzle has the confluence property, this may change the resolution path but this cannot change the final rating with respect to this theory: it is obtained at the end of any resolution path. If whips or g-whips are activated but not braids or g-braids, this may change the resolution path and lead to an apparently different W+S or gW+S rating, but this happens very rarely.

I've also introduced this option in the other applications of CSP-Rules that use Subsets [LatinRules, FutoRules, KakuRules and HidatoRules (tests in progress)]

As an example of the difference, consider the following puzzle:
..9.2.48.6....89..82..9...1.9.......7.8...1.2.......7.9...7..65..61....9.52.6.8..
Code: Select all
`..9.2.48.6....89..82..9...1.9.......7.8...1.2.......7.9...7..65..61....9.52.6.8..`

Activating only Singles, Whips[1] (= claiming+pointing), Subsets and FinnedFish, the two resolution paths start the same way:
Code: Select all
`singles ==> r9c9 = 7, r2c9 = 3, r1c9 = 6, r3c8 = 5, r2c8 = 2, r3c7 = 7, r2c3 = 7, r8c2 = 7, r7c2 = 8, r7c3 = 1, r9c8 = 1, r8c8 = 4, r4c8 = 3, r5c8 = 9, r8c1 = 3, r8c7 = 2, r7c7 = 3, r8c6 = 5, r8c5 = 8, r9c1 = 4, r1c1 = 5whip[1]: c5n3{r6 .} ==> r6c6 ≠ 3, r6c4 ≠ 3whip[1]: c1n1{r6 .} ==> r6c2 ≠ 1whip[1]: c5n3{r6 .} ==> r5c6 ≠ 3whip[1]: r5n5{c5 .} ==> r6c5 ≠ 5, r6c4 ≠ 5whip[1]: c5n3{r6 .} ==> r5c4 ≠ 3whip[1]: r5n5{c5 .} ==> r4c5 ≠ 5, r4c4 ≠ 5`

At this point, a hidden quad appears in the central block for digits 2789:
Code: Select all
`24678  14      12467456    345     46     24689  134     12469  `

and the usual version of SudoRules gives:
Code: Select all
`hidden-quads-in-a-block: b5{r6c6 r4c6 r4c4 r6c4}{n2 n7 n8 n9} ==> r6c6 ≠ 6hidden-quads-in-a-block: b5{r6c6 r4c6 r4c4 r6c4}{n2 n7 n8 n9} ==> r6c6 ≠ 4hidden-quads-in-a-block: b5{r6c6 r4c6 r4c4 r6c4}{n2 n7 n8 n9} ==> r6c6 ≠ 1hidden-pairs-in-a-column: c6{n1 n7}{r1 r4} ==> r4c6 ≠ 6hidden-pairs-in-a-column: c6{n1 n7}{r1 r4} ==> r4c6 ≠ 4hidden-pairs-in-a-column: c6{n1 n7}{r1 r4} ==> r4c6 ≠ 2hidden-pairs-in-a-column: c6{n1 n7}{r1 r4} ==> r1c6 ≠ 3hidden-triplets-in-a-block: b5{r6c6 r4c4 r6c4}{n2 n8 n9} ==> r6c4 ≠ 6hidden-triplets-in-a-block: b5{r6c6 r4c4 r6c4}{n2 n8 n9} ==> r6c4 ≠ 4hidden-triplets-in-a-block: b5{r6c6 r4c4 r6c4}{n2 n8 n9} ==> r4c4 ≠ 7stte`

which I usually simplify manually for publication to:
Code: Select all
`hidden-quads-in-a-block: b5{r6c6 r4c6 r4c4 r6c4}{n2 n7 n8 n9} ==> r6c6 ≠ 6, r6c6 ≠ 4, r6c6 ≠ 1hidden-pairs-in-a-column: c6{n1 n7}{r1 r4} ==> r4c6 ≠ 6, r4c6 ≠ 4, r4c6 ≠ 2, r1c6 ≠ 3hidden-triplets-in-a-block: b5{r6c6 r4c4 r6c4}{n2 n8 n9} ==> r6c4 ≠ 6, r6c4 ≠ 4, r4c4 ≠ 7stte`

It's interesting to notice that the hidden-triplets is a degenerated part of the original hidden quad. It illustrates the idea that in a resolution theory with the confluence property (as chosen here), if a rule (hidden-quads) is no longer available to make eliminations that it could have done but it has not done (because it has been interrupted or for any other reason), there will always be other rules available to do these eliminations.

If the new option is chosen, we get instead (with no manual change):
Code: Select all
`hidden-quads-in-a-block: b5{r6c6 r4c6 r4c4 r6c4}{n2 n7 n8 n9} ==> r6c6 ≠ 6, r6c6 ≠ 4, r6c6 ≠ 1, r6c4 ≠ 6, r6c4 ≠ 4, r4c6 ≠ 6, r4c6 ≠ 4, r4c6 ≠ 1, r4c4 ≠ 6, r4c4 ≠ 4stte`
denis_berthier
2010 Supporter

Posts: 2757
Joined: 19 June 2007
Location: Paris

### Re: Subsets in SudoRules

denis_berthier wrote:I've also introduced this option in the other applications of CSP-Rules that use Subsets [LatinRules, FutoRules, KakuRules and HidatoRules (tests in progress)]

Why do you need to do it for each application separately? Aren't the rules in CSP-Rules generic, i.e. application-independent?

"Almost all" the rules in CSP-Rules are indeed generic, i.e. they can be (and are) used by all the applications without any change (*). This includes bivalue-chains, whips, braids, g-bivalue-chains, g-whips, g-braids, forcing-whips, forcing-braids and all the more complex rules described in chapter 11 of PBCS. This also includes procedures that are not resolution rules and don't produce a readable resolution path, such as T&E and DFS.

However, Subsets (and the chain rules including Subsets as sub-patterns) are not coded in a generic way in CSP-Rules. The only way to do this would be utterly inefficient. Instead, for every application that has a grid structure relevant for Subsets (currently: Sudoku, LatinSquare, Futoshiki, Kakuro, Hidato and Numbrix), CSP-Rules has specific code. Of course the code for LatinSquares is part of the code for Sudoku and the code for Futoshiki is part of the code for LatinSquares. But the code for Numbrix and Hidato is slightly different. And the code for Kakuro has to be restricted to sectors; it is not inherently much harder, but it has to be written carefully.
Needless to say, each application must then be tested for this new option and that's probably the most time-consuming part.

(*)
1) For efficiency reasons, the most elementary rules (elementary constraints propagation and singles) may have an application-specific version that will over-write the corresponding generic rules. But that's the only exception.
2) Of course, in addition to the above-mentioned rules, any application may have other application-specific rules (such as uniqueness rules, sk-loops, J-Exocets, ... for Sudoku)
denis_berthier
2010 Supporter

Posts: 2757
Joined: 19 June 2007
Location: Paris

### Whips[1] in SudoRules

Short whips, especially whips[1], are another example of interruptions of potential eliminations when a pattern has been detected; for whips[1], they are often interrupted by other whips[1] and they may reappear later to finish their work. As the final result of a sequence of eliminations by whips[1] and of assertions by Singles is independent of the order of whips[1] eliminations, an option that makes all the eliminations for a given whip[1] at the same time cannot change the global final result. This makes these interruptions slightly unnerving when reading a resolution path.

I've therefore coded the same kind of option for whips[1] as for Subsets and I could do it in a generic way.
The good news is, both options come with no degradation of speed or memory requirements.

As a simple example of the difference, consider the same puzzle as in my first post:
..9.2.48.6....89..82..9...1.9.......7.8...1.2.......7.9...7..65..61....9.52.6.8..
where only Singles, Whips[1], Subsets and FinnedFish are activated.
The difference appears clearly at the start of the resolution paths, after the singles:

- raw output without the option:
Code: Select all
`whip[1]: c5n3{r6 .} ==> r6c6 ≠ 3whip[1]: c5n3{r6 .} ==> r6c4 ≠ 3whip[1]: c1n1{r6 .} ==> r6c2 ≠ 1whip[1]: c5n3{r6 .} ==> r5c6 ≠ 3whip[1]: r5n5{c5 .} ==> r6c5 ≠ 5whip[1]: r5n5{c5 .} ==> r6c4 ≠ 5whip[1]: c5n3{r6 .} ==> r5c4 ≠ 3whip[1]: r5n5{c5 .} ==> r4c5 ≠ 5whip[1]: r5n5{c5 .} ==> r4c4 ≠ 5`

- raw output with the option:
Code: Select all
`whip[1]: c5n3{r6 .} ==> r6c6 ≠ 3, r5c4 ≠ 3, r5c6 ≠ 3, r6c4 ≠ 3whip[1]: c1n1{r6 .} ==> r6c2 ≠ 1whip[1]: r5n5{c5 .} ==> r6c5 ≠ 5, r4c4 ≠ 5, r4c5 ≠ 5, r6c4 ≠ 5`

The end of the resolution path has no whips and is unchanged

As an example for a much more difficult puzzle, take the first in the Magictour collection:
4...3.......6..8..........1....5..9..8....6...7.2........1.27..5.3....4.9........
SER = 9.0, W-rating=10
Code: Select all
`4...3.......6..8..........1....5..9..8....6...7.2........1.27..5.3....4.9........`

where Subsets, Finned-Fish, bivalue-chains and whips are activated.

Here are :
- the raw resolution path without the two options (for whips[1] and Subsets):
Hidden Text: Show
Code: Select all
`hidden-single-in-a-block ==> r9c3 = 7272 candidates, 2018 csp-links and 2018 links. Density = 5.47536357716518%whip[1]: r7n5{c9 .} ==> r9c9 ≠ 5whip[1]: r7n5{c9 .} ==> r9c8 ≠ 5whip[1]: r7n5{c9 .} ==> r9c7 ≠ 5whip[1]: r7n3{c9 .} ==> r9c9 ≠ 3whip[1]: r7n3{c9 .} ==> r9c8 ≠ 3whip[1]: r7n3{c9 .} ==> r9c7 ≠ 3whip[1]: c2n9{r3 .} ==> r3c3 ≠ 9whip[1]: c2n5{r3 .} ==> r3c3 ≠ 5whip[1]: c2n9{r3 .} ==> r2c3 ≠ 9whip[1]: c2n5{r3 .} ==> r2c3 ≠ 5whip[1]: c2n9{r3 .} ==> r1c3 ≠ 9whip[1]: c2n5{r3 .} ==> r1c3 ≠ 5whip[1]: b7n2{r9c2 .} ==> r4c2 ≠ 2whip[1]: b7n1{r9c2 .} ==> r4c2 ≠ 1whip[1]: b7n2{r9c2 .} ==> r3c2 ≠ 2whip[1]: b7n2{r9c2 .} ==> r2c2 ≠ 2whip[1]: b7n1{r9c2 .} ==> r2c2 ≠ 1whip[1]: b7n2{r9c2 .} ==> r1c2 ≠ 2whip[1]: b7n1{r9c2 .} ==> r1c2 ≠ 1whip[1]: b7n8{r7c3 .} ==> r7c9 ≠ 8whip[1]: b7n8{r7c3 .} ==> r7c8 ≠ 8whip[1]: b7n8{r7c3 .} ==> r7c5 ≠ 8hidden-pairs-in-a-row: r9{n3 n5}{c4 c6} ==> r9c6 ≠ 8hidden-pairs-in-a-row: r9{n3 n5}{c4 c6} ==> r9c6 ≠ 6hidden-pairs-in-a-row: r9{n3 n5}{c4 c6} ==> r9c6 ≠ 4hidden-pairs-in-a-row: r9{n3 n5}{c4 c6} ==> r9c4 ≠ 8hidden-pairs-in-a-row: r9{n3 n5}{c4 c6} ==> r9c4 ≠ 4whip[1]: b8n4{r9c5 .} ==> r2c5 ≠ 4whip[1]: b8n4{r9c5 .} ==> r3c5 ≠ 4whip[1]: b8n4{r9c5 .} ==> r5c5 ≠ 4whip[1]: b8n4{r9c5 .} ==> r6c5 ≠ 4hidden-pairs-in-a-column: c2{n1 n2}{r8 r9} ==> r9c2 ≠ 6hidden-pairs-in-a-column: c2{n1 n2}{r8 r9} ==> r9c2 ≠ 4hidden-single-in-a-row ==> r9c5 = 4whip[1]: r9n6{c9 .} ==> r7c8 ≠ 6whip[1]: r9n6{c9 .} ==> r7c9 ≠ 6whip[1]: r9n6{c9 .} ==> r8c9 ≠ 6whip[1]: r9n8{c9 .} ==> r8c9 ≠ 8naked-pairs-in-a-row: r9{c2 c7}{n1 n2} ==> r9c9 ≠ 2naked-pairs-in-a-row: r9{c2 c7}{n1 n2} ==> r9c8 ≠ 2naked-pairs-in-a-row: r9{c2 c7}{n1 n2} ==> r9c8 ≠ 1whip[1]: c8n1{r6 .} ==> r4c7 ≠ 1whip[1]: c8n1{r6 .} ==> r6c7 ≠ 1hidden-pairs-in-a-column: c2{n1 n2}{r8 r9} ==> r8c2 ≠ 6whip[1]: r8n6{c6 .} ==> r7c5 ≠ 6naked-single ==> r7c5 = 9hidden-pairs-in-a-column: c3{n5 n9}{r5 r6} ==> r6c3 ≠ 6hidden-pairs-in-a-column: c3{n5 n9}{r5 r6} ==> r6c3 ≠ 4hidden-pairs-in-a-column: c3{n5 n9}{r5 r6} ==> r6c3 ≠ 1hidden-pairs-in-a-column: c3{n5 n9}{r5 r6} ==> r5c3 ≠ 4whip[1]: b4n4{r4c3 .} ==> r4c4 ≠ 4whip[1]: b4n4{r4c3 .} ==> r4c6 ≠ 4whip[1]: b4n4{r4c3 .} ==> r4c7 ≠ 4whip[1]: b4n4{r4c3 .} ==> r4c9 ≠ 4hidden-pairs-in-a-column: c3{n5 n9}{r5 r6} ==> r5c3 ≠ 2hidden-pairs-in-a-column: c3{n5 n9}{r5 r6} ==> r5c3 ≠ 1finned-x-wing-in-columns: n4{c7 c4}{r3 r6} ==> r6c6 ≠ 4whip[1]: r6n4{c9 .} ==> r5c9 ≠ 4whip[5]: r2n4{c6 c9} - r2n9{c9 c2} - r2n5{c2 c8} - c7n5{r3 r6} - r6n4{c7 .} ==> r2c6 ≠ 7whip[5]: r2n4{c6 c9} - r2n9{c9 c2} - r2n5{c2 c8} - c7n5{r3 r6} - r6n4{c7 .} ==> r2c6 ≠ 1whip[6]: c8n2{r3 r5} - r1n2{c8 c3} - r2c3{n2 n1} - r1n1{c3 c6} - r4n1{c6 c1} - r4n2{c1 .} ==> r3c7 ≠ 2whip[6]: c8n2{r3 r5} - r1n2{c8 c3} - r2c3{n2 n1} - r1n1{c3 c6} - r4n1{c6 c1} - r4n2{c1 .} ==> r2c9 ≠ 2whip[6]: r2n4{c9 c6} - r2n9{c6 c2} - r2n5{c2 c8} - r7c8{n5 n3} - b3n3{r3c8 r3c7} - r3n4{c7 .} ==> r2c9 ≠ 7whip[7]: c7n5{r3 r6} - c7n4{r6 r3} - r2n4{c9 c6} - r2n5{c6 c2} - r2n9{c2 c9} - b3n3{r2c9 r2c8} - r7c8{n3 .} ==> r3c8 ≠ 5whip[8]: c7n3{r6 r3} - b3n4{r3c7 r2c9} - r6n4{c9 c7} - c7n5{r6 r1} - b3n9{r1c7 r1c9} - r1c2{n9 n6} - r7c2{n6 n4} - r4c2{n4 .} ==> r4c9 ≠ 3whip[8]: c7n5{r3 r6} - c7n4{r6 r3} - r2n4{c9 c6} - r2n5{c6 c2} - c9n5{r2 r7} - r7c8{n5 n3} - b3n3{r3c8 r2c9} - r2n9{c9 .} ==> r1c8 ≠ 5whip[8]: c4n4{r5 r3} - c4n9{r3 r1} - c4n5{r1 r9} - c4n3{r9 r4} - r4c7{n3 n2} - b9n2{r9c7 r8c9} - c9n9{r8 r2} - r2n4{c9 .} ==> r5c4 ≠ 7whip[8]: r1n1{c6 c3} - r1n8{c3 c4} - r8c4{n8 n7} - r4c4{n7 n3} - r4c7{n3 n2} - r9c7{n2 n1} - r8c7{n1 n9} - r1c7{n9 .} ==> r1c6 ≠ 5whip[9]: c4n9{r3 r5} - r5n4{c4 c6} - r2n4{c6 c9} - b3n9{r2c9 r3c7} - c7n4{r3 r6} - c7n3{r6 r4} - b5n3{r4c6 r6c6} - r9c6{n3 n5} - r2c6{n5 .} ==> r1c6 ≠ 9whip[9]: r8c4{n8 n7} - r4c4{n7 n3} - r4c7{n3 n2} - r5n2{c9 c1} - b4n3{r5c1 r6c1} - c7n3{r6 r3} - r3n4{c7 c6} - r3n9{c6 c2} - r3n5{c2 .} ==> r3c4 ≠ 8whip[9]: r8c4{n7 n8} - r4c4{n8 n3} - r4c7{n3 n2} - r5n2{c9 c1} - b4n3{r5c1 r6c1} - c7n3{r6 r3} - r3n4{c7 c6} - r3n9{c6 c2} - r3n5{c2 .} ==> r3c4 ≠ 7whip[10]: c4n4{r5 r3} - c4n9{r3 r1} - r2c6{n9 n5} - r2n4{c6 c9} - b3n9{r2c9 r3c7} - r3n5{c7 c2} - c2n9{r3 r2} - c2n3{r2 r4} - c7n3{r4 r6} - r6n4{c7 .} ==> r5c4 ≠ 3whip[9]: c7n4{r3 r6} - c7n3{r6 r4} - c4n3{r4 r9} - r9n5{c4 c6} - r2n5{c6 c2} - c2n3{r2 r3} - c2n9{r3 r1} - b3n9{r1c7 r2c9} - c9n4{r2 .} ==> r3c7 ≠ 5whip[6]: r3n5{c6 c2} - c4n5{r3 r9} - c4n3{r9 r4} - c2n3{r4 r2} - r2n9{c2 c9} - r2n4{c9 .} ==> r2c6 ≠ 5whip[3]: c4n9{r3 r5} - r5n4{c4 c6} - r2c6{n4 .} ==> r3c6 ≠ 9whip[3]: r2c6{n4 n9} - b5n9{r5c6 r5c4} - r5n4{c4 .} ==> r3c6 ≠ 4whip[5]: r4c7{n3 n2} - r5n2{c9 c1} - r5n3{c1 c6} - c6n4{r5 r2} - c9n4{r2 .} ==> r6c9 ≠ 3whip[6]: c7n3{r6 r3} - r4c7{n3 n2} - r5n2{c9 c1} - r5n3{c1 c6} - r5n4{c6 c4} - r3n4{c4 .} ==> r6c8 ≠ 3whip[7]: c8n1{r5 r6} - c5n1{r6 r2} - r5c5{n1 n7} - r4n7{c6 c9} - b6n8{r4c9 r6c9} - c9n4{r6 r2} - c6n4{r2 .} ==> r5c6 ≠ 1whip[7]: r7c2{n6 n4} - r4c2{n4 n3} - c4n3{r4 r9} - r9n5{c4 c6} - r3n5{c6 c4} - r3n4{c4 c7} - r3n9{c7 .} ==> r3c2 ≠ 6whip[7]: c7n4{r3 r6} - c7n5{r6 r1} - r2n5{c9 c2} - c2n3{r2 r4} - c4n3{r4 r9} - c4n5{r9 r3} - r3n4{c4 .} ==> r3c7 ≠ 3whip[1]: c7n3{r6 .} ==> r5c8 ≠ 3whip[1]: c7n3{r6 .} ==> r5c9 ≠ 3whip[3]: r4c7{n3 n2} - r5n2{c9 c1} - r5n3{c1 .} ==> r4c6 ≠ 3whip[3]: r4c7{n3 n2} - r5n2{c9 c1} - r5n3{c1 .} ==> r4c4 ≠ 3hidden-single-in-a-column ==> r9c4 = 3naked-single ==> r9c6 = 5naked-pairs-in-a-column: c4{r4 r8}{n7 n8} ==> r1c4 ≠ 8naked-pairs-in-a-column: c4{r4 r8}{n7 n8} ==> r1c4 ≠ 7hidden-pairs-in-a-row: r1{n1 n8}{c3 c6} ==> r1c6 ≠ 7whip[1]: r1n7{c9 .} ==> r2c8 ≠ 7whip[1]: r1n7{c9 .} ==> r3c8 ≠ 7hidden-pairs-in-a-row: r1{n1 n8}{c3 c6} ==> r1c3 ≠ 6hidden-pairs-in-a-row: r1{n1 n8}{c3 c6} ==> r1c3 ≠ 2whip[1]: r1n2{c9 .} ==> r2c8 ≠ 2whip[1]: r1n2{c9 .} ==> r3c8 ≠ 2naked-pairs-in-a-column: c8{r2 r7}{n3 n5} ==> r6c8 ≠ 5naked-pairs-in-a-column: c8{r2 r7}{n3 n5} ==> r5c8 ≠ 5naked-pairs-in-a-column: c8{r2 r7}{n3 n5} ==> r3c8 ≠ 3stte`

- the raw resolution path with the two options (for whips[1] and Subsets) activated:
Hidden Text: Show
Code: Select all
`hidden-single-in-a-block ==> r9c3 = 7272 candidates, 2018 csp-links and 2018 links. Density = 5.47536357716518%whip[1]: r7n5{c9 .} ==> r9c9 ≠ 5, r9c7 ≠ 5, r9c8 ≠ 5whip[1]: r7n3{c9 .} ==> r9c9 ≠ 3, r9c7 ≠ 3, r9c8 ≠ 3whip[1]: c2n9{r3 .} ==> r3c3 ≠ 9, r1c3 ≠ 9, r2c3 ≠ 9whip[1]: c2n5{r3 .} ==> r3c3 ≠ 5, r1c3 ≠ 5, r2c3 ≠ 5whip[1]: b7n2{r9c2 .} ==> r4c2 ≠ 2, r1c2 ≠ 2, r2c2 ≠ 2, r3c2 ≠ 2whip[1]: b7n1{r9c2 .} ==> r4c2 ≠ 1, r1c2 ≠ 1, r2c2 ≠ 1whip[1]: b7n8{r7c3 .} ==> r7c9 ≠ 8, r7c5 ≠ 8, r7c8 ≠ 8hidden-pairs-in-a-row: r9{n3 n5}{c4 c6} ==> r9c6 ≠ 8, r9c6 ≠ 6, r9c6 ≠ 4, r9c4 ≠ 8, r9c4 ≠ 4whip[1]: b8n4{r9c5 .} ==> r2c5 ≠ 4, r3c5 ≠ 4, r5c5 ≠ 4, r6c5 ≠ 4hidden-pairs-in-a-column: c2{n1 n2}{r8 r9} ==> r9c2 ≠ 6, r9c2 ≠ 4, r8c2 ≠ 6hidden-single-in-a-row ==> r9c5 = 4whip[1]: r9n6{c9 .} ==> r7c8 ≠ 6, r7c9 ≠ 6, r8c9 ≠ 6whip[1]: r8n6{c6 .} ==> r7c5 ≠ 6naked-single ==> r7c5 = 9whip[1]: r9n8{c9 .} ==> r8c9 ≠ 8naked-pairs-in-a-row: r9{c2 c7}{n1 n2} ==> r9c9 ≠ 2, r9c8 ≠ 2, r9c8 ≠ 1whip[1]: c8n1{r6 .} ==> r4c7 ≠ 1, r6c7 ≠ 1hidden-pairs-in-a-column: c3{n5 n9}{r5 r6} ==> r6c3 ≠ 6, r6c3 ≠ 4, r6c3 ≠ 1, r5c3 ≠ 4, r5c3 ≠ 2, r5c3 ≠ 1whip[1]: b4n4{r4c3 .} ==> r4c4 ≠ 4, r4c6 ≠ 4, r4c7 ≠ 4, r4c9 ≠ 4finned-x-wing-in-columns: n4{c7 c4}{r3 r6} ==> r6c6 ≠ 4whip[1]: r6n4{c9 .} ==> r5c9 ≠ 4* whip[5]: r2n4{c6 c9} - r2n9{c9 c2} - r2n5{c2 c8} - c7n5{r3 r6} - r6n4{c7 .} ==> r2c6 ≠ 7* whip[5]: r2n4{c6 c9} - r2n9{c9 c2} - r2n5{c2 c8} - c7n5{r3 r6} - r6n4{c7 .} ==> r2c6 ≠ 1* whip[6]: c8n2{r3 r5} - r1n2{c8 c3} - r2c3{n2 n1} - r1n1{c3 c6} - r4n1{c6 c1} - r4n2{c1 .} ==> r3c7 ≠ 2* whip[6]: c8n2{r3 r5} - r1n2{c8 c3} - r2c3{n2 n1} - r1n1{c3 c6} - r4n1{c6 c1} - r4n2{c1 .} ==> r2c9 ≠ 2whip[6]: r2n4{c9 c6} - r2n9{c6 c2} - r2n5{c2 c8} - r7c8{n5 n3} - b3n3{r3c8 r3c7} - r3n4{c7 .} ==> r2c9 ≠ 7whip[7]: c7n5{r3 r6} - c7n4{r6 r3} - r2n4{c9 c6} - r2n5{c6 c2} - r2n9{c2 c9} - b3n3{r2c9 r2c8} - r7c8{n3 .} ==> r3c8 ≠ 5whip[8]: c7n3{r6 r3} - b3n4{r3c7 r2c9} - r6n4{c9 c7} - c7n5{r6 r1} - b3n9{r1c7 r1c9} - r1c2{n9 n6} - r7c2{n6 n4} - r4c2{n4 .} ==> r4c9 ≠ 3whip[8]: c7n5{r3 r6} - c7n4{r6 r3} - r2n4{c9 c6} - r2n5{c6 c2} - c9n5{r2 r7} - r7c8{n5 n3} - b3n3{r3c8 r2c9} - r2n9{c9 .} ==> r1c8 ≠ 5whip[8]: c4n4{r5 r3} - c4n9{r3 r1} - c4n5{r1 r9} - c4n3{r9 r4} - r4c7{n3 n2} - b9n2{r9c7 r8c9} - c9n9{r8 r2} - r2n4{c9 .} ==> r5c4 ≠ 7whip[8]: r1n1{c6 c3} - r1n8{c3 c4} - r8c4{n8 n7} - r4c4{n7 n3} - r4c7{n3 n2} - r9c7{n2 n1} - r8c7{n1 n9} - r1c7{n9 .} ==> r1c6 ≠ 5whip[9]: c4n9{r3 r5} - r5n4{c4 c6} - r2n4{c6 c9} - b3n9{r2c9 r3c7} - c7n4{r3 r6} - c7n3{r6 r4} - b5n3{r4c6 r6c6} - r9c6{n3 n5} - r2c6{n5 .} ==> r1c6 ≠ 9# whip[9]: r8c4{n8 n7} - r4c4{n7 n3} - r4c7{n3 n2} - r5n2{c9 c1} - b4n3{r5c1 r6c1} - c7n3{r6 r3} - r3n4{c7 c6} - r3n9{c6 c2} - r3n5{c2 .} ==> r3c4 ≠ 8# whip[9]: r8c4{n7 n8} - r4c4{n8 n3} - r4c7{n3 n2} - r5n2{c9 c1} - b4n3{r5c1 r6c1} - c7n3{r6 r3} - r3n4{c7 c6} - r3n9{c6 c2} - r3n5{c2 .} ==> r3c4 ≠ 7whip[10]: c4n4{r5 r3} - c4n9{r3 r1} - r2c6{n9 n5} - r2n4{c6 c9} - b3n9{r2c9 r3c7} - r3n5{c7 c2} - c2n9{r3 r2} - c2n3{r2 r4} - c7n3{r4 r6} - r6n4{c7 .} ==> r5c4 ≠ 3whip[9]: c7n4{r3 r6} - c7n3{r6 r4} - c4n3{r4 r9} - r9n5{c4 c6} - r2n5{c6 c2} - c2n3{r2 r3} - c2n9{r3 r1} - b3n9{r1c7 r2c9} - c9n4{r2 .} ==> r3c7 ≠ 5whip[6]: r3n5{c6 c2} - c4n5{r3 r9} - c4n3{r9 r4} - c2n3{r4 r2} - r2n9{c2 c9} - r2n4{c9 .} ==> r2c6 ≠ 5whip[3]: c4n9{r3 r5} - r5n4{c4 c6} - r2c6{n4 .} ==> r3c6 ≠ 9whip[3]: r2c6{n4 n9} - b5n9{r5c6 r5c4} - r5n4{c4 .} ==> r3c6 ≠ 4whip[5]: r4c7{n3 n2} - r5n2{c9 c1} - r5n3{c1 c6} - c6n4{r5 r2} - c9n4{r2 .} ==> r6c9 ≠ 3whip[6]: c7n3{r6 r3} - r4c7{n3 n2} - r5n2{c9 c1} - r5n3{c1 c6} - r5n4{c6 c4} - r3n4{c4 .} ==> r6c8 ≠ 3whip[7]: c8n1{r5 r6} - c5n1{r6 r2} - r5c5{n1 n7} - r4n7{c6 c9} - b6n8{r4c9 r6c9} - c9n4{r6 r2} - c6n4{r2 .} ==> r5c6 ≠ 1whip[7]: r7c2{n6 n4} - r4c2{n4 n3} - c4n3{r4 r9} - r9n5{c4 c6} - r3n5{c6 c4} - r3n4{c4 c7} - r3n9{c7 .} ==> r3c2 ≠ 6whip[7]: c7n4{r3 r6} - c7n5{r6 r1} - r2n5{c9 c2} - c2n3{r2 r4} - c4n3{r4 r9} - c4n5{r9 r3} - r3n4{c4 .} ==> r3c7 ≠ 3whip[1]: c7n3{r6 .} ==> r5c8 ≠ 3, r5c9 ≠ 3* whip[3]: r4c7{n3 n2} - r5n2{c9 c1} - r5n3{c1 .} ==> r4c6 ≠ 3* whip[3]: r4c7{n3 n2} - r5n2{c9 c1} - r5n3{c1 .} ==> r4c4 ≠ 3hidden-single-in-a-column ==> r9c4 = 3naked-single ==> r9c6 = 5naked-pairs-in-a-column: c4{r4 r8}{n7 n8} ==> r1c4 ≠ 8, r1c4 ≠ 7hidden-pairs-in-a-row: r1{n1 n8}{c3 c6} ==> r1c6 ≠ 7, r1c3 ≠ 6, r1c3 ≠ 2whip[1]: r1n2{c9 .} ==> r2c8 ≠ 2, r3c8 ≠ 2whip[1]: r1n7{c9 .} ==> r2c8 ≠ 7, r3c8 ≠ 7naked-pairs-in-a-column: c8{r2 r7}{n3 n5} ==> r6c8 ≠ 5, r5c8 ≠ 5, r3c8 ≠ 3stte`

The hard part is unchanged, but the difference in the easy parts is sufficiently noticeable to have been worth the coding effort.
I've marked with a * the three places where longer whips could be given the same treatment. But it doesn't seem to be worth the additional (tedious) effort. Hand editing is not a problem in such cases.

When long whips appear in a resolution path, it is rare that two of them are exactly the same:
- they often differ at the end;
- it also happens that they have the same sequence of CSP-Variables (i.e. in Sudoku, rc-, rn-, cn-, or bn- 2D-cells in the Extended Sudoku Board) with different left-linking (llc) and right-linking (rlc) candidates in their first parts as in the whips[9] marked with a # - which is perfectly understandable as the targets can only be different and may therefore not be linked to the same first llc.

I'm now pondering whether to make this behaviour the default one for SudoRules (while keeping the possibility of choosing the previous interrupted style). Anyone got an opinion?
denis_berthier
2010 Supporter

Posts: 2757
Joined: 19 June 2007
Location: Paris

### Re: Subsets in SudoRules

Hi Denis,
I will opt for the solution whips and subsets activated by default, because it is the same as using the basic techniques (singles, alignments and closed sets).
On the other hand I don't see the point of introducing the fish model equivalent to short whips.
For example a whip[2] does the same work as the finned-x-wing-in-columns: n4{c7 c4}{r3 r6} ==> r6c6 ≠ 4 .
Robert
Mauriès Robert

Posts: 486
Joined: 07 November 2019
Location: France

### Re: Whips[1] in SudoRules

denis_berthier wrote:4...3.......6..8..........1....5..9..8....6...7.2........1.27..5.3....4.9........

My solver found one MSLS, then ste.
MSLS.PNG (29.26 KiB) Viewed 426 times
Last edited by yzfwsf on Sun Mar 01, 2020 2:26 pm, edited 1 time in total.
yzfwsf

Posts: 419
Joined: 16 April 2019

### Re: Subsets in SudoRules

Mauriès Robert wrote:I will opt for the solution whips and subsets activated by default, because it is the same as using the basic techniques (singles, alignments and closed sets).

In my default choice of rules, I have Subsets, Finned-Fish and whips ("Alignements" and whips[1] are exactly the same thing - except that whips[1] are meaningful in a much broader context than Sudoku). But the user can make many more choices.
Whips are enough to solve almost all the puzzles in T&E(1) and are much more than enough to solve all the human solvable puzzles.
One more pattern I often use is g-whips. They are particular useful in Kakuro.

Mauriès Robert wrote:On the other hand I don't see the point of introducing the fish model equivalent to short whips.
For example a whip[2] does the same work as the finned-x-wing-in-columns: n4{c7 c4}{r3 r6} ==> r6c6 ≠ 4 .

You are right about this example. And, more generally, all the Subsets[2] and finned-Fish[2] are useless when we have whips[2]. Indeed, I've proven in PBCS that whips[2] are universal among patterns based on only two CSP-Variables, i.e. any such pattern can be replaced by whips[2] to make the same eliminations.
However:
- Subsets are a familiar pattern and this makes it interesting to have separate rules for them, even when they are not necessary
- in PBCS, I've also proven that there are rare cases of (larger) Subsets that cannot be considered as whips. In such cases, they may lead to shorter resolution paths.

As of now, SudoRules is not public.
Recently, I've done some work to make installation and choice of rules simpler for all the CSP-Rules applications. I've also done some work to make the output shorter - as shown in my first posts. But making it public would require more:
- writing a user manual (I've done it in part, but that's a very boring work and I always find something more challenging to do; as a result, I go slowly)
- writing an installation procedure for Windows. Mine currently works on Unix (including MacOS).

I'm not even sure it's worth the work:
- there's no graphical user interface: this eliminates 99% of the potential users
- it requires the installation of another software, the core of the CLIPS inference engine (https://sourceforge.net/p/clipsrules/code/HEAD/tree/branches/63x/core/)
- it requires some basic understanding of how an inference engine works, though the user manual is designed so as to make any real knowledge of Clips unnecessary, unless one wants to write new rules of his own.This probably eliminates 99% of the remaining 1%.
- the nrc notation is the only consistent notation, but most people on this forum are unable to see it because they are totally bogged down in the AIC notation. This will eliminate almost all the active members of this forum.
This leaves me with a few of the readers of HLS and/or PBCS that keep asking me.

But my question was about the cosmetic changes shown in the examples. Which of the old or the new (shorter) versions do you prefer to read as the default output? (This is totally independent on the choice of rules.)
denis_berthier
2010 Supporter

Posts: 2757
Joined: 19 June 2007
Location: Paris

### Re: Whips[1] in SudoRules

yzfwsf wrote:
denis_berthier wrote:..9.2.48.6....89..82..9...1.9.......7.8...1.2.......7.9...7..65..61....9.52.6.8..

My solver found one MSLS.

What is MSLS? In French, it evokes some form of MST (STD).
denis_berthier
2010 Supporter

Posts: 2757
Joined: 19 June 2007
Location: Paris

### Re: Subsets in SudoRules

denis_berthier wrote:But my question was about the cosmetic changes shown in the examples. Which of the old or the new (shorter) versions do you prefer to read as the default output? (This is totally independent on the choice of rules.)

I prefer the new version because it's closer to what I get with anti-tracks.
I also prefer g-whips to whips, because that too is closer to what I do with anti-tracks.
Concerning the nrc notations, one of the interests seems to me to be the correspondence between the spaces rc, rn, cn. In my TDP concept I gave my readers on my site Assistant Sudoku, the possibility to work on the 3 spaces to draw tracks (you can see it by this link https://www.assistant-sudoku.com/Loupe_Sudoku.php?Cde=GN, with the possibility to change spaces with the CN and LN buttons), but I didn't really try to go further than that for the moment.
Robert
PS : MSLS = Multi-Sector Locked Sets -> http://forum.enjoysudoku.com/using-multi-sector-locked-sets-t31222.html
Mauriès Robert

Posts: 486
Joined: 07 November 2019
Location: France

### Re: Subsets in SudoRules

Mauriès Robert wrote:Concerning the nrc notations, one of the interests seems to me to be the correspondence between the spaces rc, rn, cn.

It's not by chance. I introduced the nrc notation based on my analysis fo the CSP-Variables at work in Sudoku.

Mauriès Robert wrote:I gave my readers on my site Assistant Sudoku, the possibility to work on the 3 spaces to draw tracks [...]with the possibility to change spaces with the CN and LN buttons), but I didn't really try to go further than that for the moment.

Great! The rn-, cn- and bn- spaces that I introduced in the "Hidden Logic of Sudoku" have rarely been implemented. I remember Ruud did it in his solver long ago, but as it worked only on Windows, I could never see it.

Mauriès Robert wrote:MSLS = Multi-Sector Locked Sets -> http://forum.enjoysudoku.com/using-multi-sector-locked-sets-t31222.html

Thanks for the reference.
Last edited by denis_berthier on Mon Mar 02, 2020 7:48 am, edited 1 time in total.
denis_berthier
2010 Supporter

Posts: 2757
Joined: 19 June 2007
Location: Paris

### Re: Whips[1] in SudoRules

yzfwsf wrote:
denis_berthier wrote:4...3.......6..8..........1....5..9..8....6...7.2........1.27..5.3....4.9........

My solver found one MSLS, then ste.
MSLS.PNG

Now that I see what MSLS means, it's seems quite absurd to use it in this case, as the hidden-quad is a much simpler pattern.
Anyway, this is very far from the topic of this thread.

This was also the opportunity for me to discover your solver. Nice work.
denis_berthier
2010 Supporter

Posts: 2757
Joined: 19 June 2007
Location: Paris