CSP-Rules, SudoRules, KakuRules...

Programs which generate, solve, and analyze Sudoku puzzles

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Thu May 05, 2022 5:34 am

.
I've added functions for solving files of sukakus, with self-explaining names.

For Sukaku puzzles given in the 729-character string format (one string per line, with no quotes), with syntax:
- (solve-n-sukakus-after-first-p-from-string-file ?file-name ?p ?n)
- (solve-n-sukakus-after-first-p-from-string-file-excluding ?file-name ?p ?n ?l-out)
?l-out is the list of puzzle numbers (i.e. their line number in the file) that are excluded from the computations

For Sukaku puzzles given in the much more readable list format (one list per line), with syntax:
- (solve-n-sukakus-after-first-p-from-list-file ?file-name ?p ?n)
- (solve-n-sukakus-after-first-p-from-list-file-excluding ?file-name ?p ?n ?l-out)
?l-out is the list of puzzle numbers (i.e. their line number in the file) that are excluded from the computations

In all the cases, the sukaku is pretty-printed (in the visually more appealing grid format) after initialisation of each puzzle.

The [BUM] will be updated later.
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Sat May 07, 2022 3:36 am

.
I've updated the Basic User Manual [BUM] with all the functionalities mentioned in my previous post - and for all the new ones described below.

- All the generic T&E procedures (at depths 1, 2 or 3) have been made sensitive to restrictions on the candidates they may try (at each level). They are totally unchanged in the default case. In and of itself, this only allows new possibilities, but doesn't offer them readily.

- I have added to SudoRules functions related to k-digit patterns:
(solve-k-digit-pattern-string ?k ?string)
(solve-n-grids-after-first-p-from-k-digit-pattern-string-file ?k ?file-name ?p ?n)
(solve-n-grids-after-first-p-from-k-digit-pattern-string-fileexcluding ?k ?file-name ?p ?n $?l-out)
Given a k-digit pattern (in string format) or a file containing a sequence of such patterns, they allow to solve them (e.g. to prove they are contradictory).

When T&E is involved, they restrict the candidates that may be tried at each level to those in the pattern, thus taking advantage of the new generic feature of T&E. By avoiding to try unproductive candidates, this makes these procedures thousands to millions of times faster than standard T&E (depending on T&E-depth).

- As these new features were motivated by eleven's list of contradictory 3-digit patterns (http://forum.enjoysudoku.com/chromatic-patterns-t39885-41.html), I've added the full analysis of this list in the SudoRules directory of https://github.com/denis-berthier/CSP-Rules-Examples. (As previously announced, CSP-Rules examples are now in a separate repository).
This is what allowed to find a single such pattern among 380 that required T&E(3) for the proof of contradiction.

- In https://github.com/denis-berthier/CSP-Rules-Examples, I've also added several proofs of contradiction for the 3-digit trivalue oddagon pattern.
.
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Wed Jun 22, 2022 6:54 am

.
Minor update:
- added functions for 1-steppers or 2-steppers for puzzles given in grid format: find-sukaku-grid-1-steppers-wrt-W1, find-sukaku-grid-2-steppers-wrt-W1, find-sukaku-1-steppers and find-sukaku-2-steppers
- printing the number of g-candidates, csp-g-links and g-links is now controlled by ?*print-actions* instead of ?*printi-init-details* (more in line with how the printing of candidates, csp-links and links is controlled)
- some (not yet documented) classification functions (for solving files of puzzles) have been renamed (classify-xxx instead of stats-xxx. Such functions are the basis for further statistical studies.
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Sun Aug 07, 2022 6:33 am

.
The April update on GitHub has introduced the tridagon elimination rule and tridagon-forcing-whips.

Today's update is also all about the tridagon pattern:
- addition of Sudoku-specific rules for detecting the general anti-tridagon pattern (defined here: http://forum.enjoysudoku.com/the-tridagon-rule-t39859-95.html and its guardians and for asserting the corresponding ORk relation;
- addition of generic rules for ORk-Forcing-Whips, k=2,3,4,5 (defined here: http://forum.enjoysudoku.com/or-k-forcing-whips-t40189.html
- corresponding update of the Basic User Manual, with many examples of how to use all of the above.

All these rules make a very powerful way to deal with the known T&E(3) puzzles (i.e. those based on some anti-tridagon pattern).

Notice what's written in the User Manual: when dealing with T&E(3) puzzles, the max size of whips and ORk-Forcing-Whips must be increased progressively in order to avoid combinatorial explosion (the more so as k increases).
There are many ways of using all the rules. See the manual.
Priorities between whips, ORk-Forcing-Whips and the detection of the anti-tridagon-pattern that allows to use them are defined in a way that lets much freedom to the user in terms of minimising the number of guardians vs minimising the length of whips before the first use of the anti-tridagon pattern.

Notice that the previously defined tridagon-forcing-whips are somehow over-ridden by the new ORk-Forcing-Whips. But the priorities are defined differently.
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Fri Aug 19, 2022 4:37 pm

.
Small update today:
- addition of Forcing2-Whips (equivalent to Forcing-Whips) and Forcing3-Whips, based on the general ORk-Forcing-Whips and with (3D) bivalue or trivalue cells as starting points (see 2nd post here: http://forum.enjoysudoku.com/or-k-forcing-whips-t40189.html)
- corresponding update of the User Manual

[Edit]: I also added rules for automatically applying eleven's replacement method in relation with tridagons. (It seems I had forgotten to post this before.)
[EDit2]: I also added examples of ORk-Forcing-Whips based on anti-tridagons in the Sudoku/Tridagons folder of https://github.com/denis-berthier/CSP-Rules-Examples
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Sun Aug 28, 2022 3:21 am

.
Today's update is again for advanced users.
It allows to use functions "solve-k-digit-pattern-string", "solve-n-grids-after-first-p-from-k-digit-pattern-string-file" and "solve-n-grids-after-first-p-from-k-digit-pattern-string-file-excluding" in combination with DFS instead of T&E(n).
This may be useful if one only wants to prove that a k-digit pattern is contradictory instead of wanting to prove this in a specific T&E(n). But, contrary to what we get by using T&E, the proof with DFS can't be used to provide ideas for a simpler proof.
Notice that if both k and the number of k-cells are large (k ≥ 4), computation time may become very long - though it is still drastically improved wrt standard DFS.
An example of application is the following 3-digit pattern from eleven:

Code: Select all
+-------------------------------+-------------------------------+-------------------------------+
! 123456789 123456789 123456789 ! 123456789 123456789 123       ! 123456789 123456789 123       !
! 123456789 123456789 123       ! 123456789 123456789 123456789 ! 123456789 123       123456789 !
! 123456789 123       123456789 ! 123456789 123       123456789 ! 123       123456789 123456789 !
+-------------------------------+-------------------------------+-------------------------------+
! 123456789 123456789 123456789 ! 123456789 123       123456789 ! 123456789 123456789 123       !
! 123456789 123456789 123       ! 123456789 123456789 123       ! 123       123456789 123456789 !
! 123456789 123       123456789 ! 123       123456789 123456789 ! 123456789 123       123456789 !
+-------------------------------+-------------------------------+-------------------------------+
! 123456789 123456789 123456789 ! 123456789 123456789 123456789 ! 123456789 123456789 123456789 !
! 123456789 123456789 123456789 ! 123456789 123456789 123456789 ! 123456789 123456789 123456789 !
! 123456789 123456789 123456789 ! 123456789 123456789 123456789 ! 123456789 123456789 123456789 !
+-------------------------------+-------------------------------+-------------------------------+

000001001001000010010010100000010001001001100010100010

As I have shown previously, it is the only one in his list of 380 contradictory 3-digit patterns that may require depth 3 of T&E for the proof that it is contradictory.
If one only wants a proof of contradiction, DFS is much faster.
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Wed Sep 07, 2022 6:36 am

.
Today's update on GitHub https://github.com/denis-berthier/CSP-Rules-V2.1 is all about the impossible trivalue oddagon pattern, the general anti-tridagon pattern that avoids it and the rules one may use to take advantage of it.
It mainly includes additions to the generic part of CSP-Rules:
- addition of OR6-Forcing-Whips (ORk-Forcing-Whips, k=1,...5, were already available)
- addition of ORk-Contrad-Whips, k=2,...6 (http://forum.enjoysudoku.com/ork-forcing-whips-and-ork-contrad-whips-t40189.html)
- technical update of some generic files (irrelevant to the standard user).

The SudoRules part allowing to use it (i.e. the identification of anti-tridagons and the corresponding ORk relations) were already available.
Parts in the SudoRules config file have been added for allowing to activate the above rules.

What's missing in this update is one of the Basic User Manual (but it's coming soon)
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Sun Sep 11, 2022 4:44 am

.
After recently adding the generic ORk-Contrad-Whips and the possibility to use them based on Tridagon-based ORk relations, I've just added on GitHub a corresponding set of preferences TRIDAGON-ORk-CW, allowing to apply them before any other rule (apart from Subsets), when one uses function "solve-with-preferences" / "solve-w-prefs".
See http://forum.enjoysudoku.com/post325129.html#p325129 for an example of use.
.
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Fri Sep 16, 2022 4:05 pm

.
The update of the Basic User Manual promised in a previous post and explaining how to use the new ORk-Forcing and ORk-Contrad Whips is published on GitHub.
It also includes the classification results mentioned here: http://forum.enjoysudoku.com/the-tridagon-rule-t39859-105.html
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Mon Oct 17, 2022 5:56 am

.
CSP-Rules user wrote:Do you plan to make your new ORk-whip rules public?

Yes.
I'm preparing an update to CSP-Rules that will include them. It will also include:
- some cleaning and polishing of any previous tridagon thing;
- more flexibility in the way to use all the new ORk-chain rules;
- ultra-persistency of the OR-relations;
- new sets of tridagon-related preferences to use with function "solve-w-prefs";
- a new, largely re-structured version of the user manual.

About the manual: the SudoRules chapter had grown much too large; it will be reduced to its elementary part; and two new chapters ("dealing with requirements on the number of steps" and "tridagon ....") will appear at the end of the book.
Moreover, some other parts will be largely re-written/extended.
An extended version of the classification results for ORk-chains (http://forum.enjoysudoku.com/the-tridagon-rule-t39859-105.html and next posts) will be included (some additional calculations are still running). I consider such results as a useful guide for choosing which ORk rules to activate and with which length.

All this takes time (the 1st edition of the manual was 100 p.; the 2nd 170; the 3rd is expected about to be 250). My best estimate is early November ± 1 week.
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Sun Nov 06, 2022 8:07 am

.
I published on GitHub (https://github.com/denis-berthier/CSP-Rules-Examples) an enlarged list of tridagon-related examples.
Many of them are revisited versions of the examples I proposed in the "puzzles" section.

(The updates mentioned in the previous posts are not yet fully ready, but they are not far.)
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Tue Nov 08, 2022 6:57 am

.
I've published a main update of CSP-Rules on GitHub (https://github.com/denis-berthier/CSP-Rules-V2.1).

It allows to use ORk-Whips, for k ≤ 6.
It has new control variables, including two for the priority of ORk-chains:
- ?*use-high-Tridagon-salience* : if TRUE (the default), the Tridagon elimination rule and the anti-tridagon detection rule will be applied immediately after Triplets; (otherwise, priority is pushed down to the chains of length 12, because the pattern relies on 12 CSP-Variables).
- ?*ORk-Forcing-Whips-before-ORk-Whips* : it TRUE (the default), ORk-Forcing-Whips have higher priority than ORk-Whips (and ORk-Contrad-Whips) of same length. I added this because there's no real reason to prefer the ones over the others.

I've also added sets of preferences for the Tridagon related rules, to be used with function "solve-w-preferences". Beware that this may be interesting only in relatively rare cases where tridagon chain rules don't need to be intermingled with regular chain rules.

I've also added a file "UPDATES.md" summarising the main updates since the first publication on August 19th, 2020.
(Minor updates, such as improving some print functions, are not mentioned.)

Another major change is the user manual; it's no longer the "Basic User Manual", but the "Augmented User Manual (AUM)".
As mentioned in a previous post, a less elementary part has been added at the end, in order not to overload the SudoRules chapter.
It includes anything about requirements on the length of the resolution path.
It also includes the complete results of my detailed studies of mith's 63,137 min-expand puzzles in T&E(3).
The "Augmented User Manual" is included in the Publications and Docs folders of CSP-Rules. If you don't want to download CSP-Rules, you can also read it on ResearchGate or download it from there: https://www.researchgate.net/publication/365186265_Augmented_User_Manual_for_CSP-Rules-V21
.
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Wed Nov 16, 2022 5:53 am

.
Minor update to SudoRules on GitHub:
- fix some abbreviations for 1-step or 2-step solutions
- add functions "solve-sukaku-list-by-eleven-replacement2" and "solve-sukaku-grid-by-eleven-replacement2"
Similar functions already existed for 3 or 4 digits in 3 or 4 cells, but I thought 2 wouldn't be very useful (I still think the same, but I added these functions for completeness). You can see an example of using it here: http://forum.enjoysudoku.com/hard-no-2-t40541-6.html
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Mon Nov 28, 2022 6:44 am

.
Today's update on GitHub is about having faster ORk-whips for k > 3. They are about 30% to 50% faster (depending on k and on many contextual factors) and they also use less memory.
For technical reasons, these improvements work only when ORk-forcing-whips are not active. Which version is used is automatic: new fast one if ORk-forcing-whips not active, original one otherwise.
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

Re: CSP-Rules, SudoRules, KakuRules...

Postby denis_berthier » Wed Dec 07, 2022 11:30 am

.
Today's update on GitHub has two unrelated parts:

1) All the ORk-relations of size ≤ 20 are now ultra-persistent.
Previously, size for applying persistency was limited to 12, but there are rare anti-tridagons with 20 guardians (though I have no example where ultra-persistency of ORk-relations with so many guardians would ultimately lead to any elimination).

2) Add Forcing2-T&E and Forcing3-T&E.
For a long time, I had hesitated tp publish them because they are very inelegant ways of solving a puzzle. I had finally mentioned them in the User Manual several months ago, but I had forgotten to post the code at that time - a typical Freudian slip, now fixed.
denis_berthier
2010 Supporter
 
Posts: 3975
Joined: 19 June 2007
Location: Paris

PreviousNext

Return to Software