.
a user of CSP-Rules wrote:On GitHub, you write that CSP-Rules is a general solver of finite Constraint Satisfaction Problems.
SudoRules being the application of CSP-Rules to Sudoku, does that imply that SudoRules is a general solver of Sudokus?
The word "general" can be understood in many ways.
1) First, what I wrote on GitHub is more precisely: CSP-Rules is a general
pattern-based solver of finite Constraint Satisfaction Problems.
To be still more precise, I should have written what I wrote in many other places: CSP-Rules is a general pattern-based solver of finite
binary Constraint Satisfaction Problems.
Each word is important.
"
Finite" implies in particular that CSP-Rules cannot deal with CSPs with continuous CSP-Variables; they require very different techniques.
"
Binary" means that all the constrains of the CSP are binary and can therefore be interpreted as binary contradictions between candidates. That is essential to the definition of chain rules. I have however shown in [PBCS] that many CSPs that don't appear to be binary in their original formulation (such as Kakuro, Futoshiki, Slitherlink...) can be efficiently turned into binary ones by adding application-specific CSP-Variables.
Of course, the above two conditions are satisfied in Sudoku.
"
Pattern-based" is probably the most important qualification. There are lots of general CSP solvers with a main/only goal of producing a solution as fast as possible. This is very useful in many CSPs and this is also essential when the solver has to be used as part of a generator.
Contrary to such solvers, CSP-Rules main goal is to produce an understandable solution, with a justification of each step by a predefined resolution rule, i.e. to produce a readable resolution path in addition to a solution. This is a radically different (and computational much harder) problem.
[CSP-Rules is also "pattern-based" in a second sense: it is coded in a pattern-based way (and, AFAIK, it is the only such solver).]
"
General" means that, apart from the above restrictions, CSP-Rules can be applied to any CSP.
Obviously, this must be tempered by practical considerations about memory and computation times, depending on CSP size - as in any other CSP solver.
2) Now, about SudoRules being general: choose your meaning of "general" to get your answer.
It is a general Sudoku solver in the above sense.
It is also general in the sense that it can solve any puzzle solvable by a human (and very much harder ones).
It is not "general" in the sense of including all the popular patterns. Although it has rules for patterns specific to Sudoku, both general ones (Subsets, Finned-Fish) and "exotic" ones (sk-loops, J-Exocets, UR, BUGS...), only the basic versions of these rules are included (and not their myriad possible variants).
Notice that there are many other "general" Sudoku solvers that produce full resolution paths. However, AFAIK, SudoRules is the only one that is "pattern-based" all the way down to its code:
the resolution rules are the code.
One consequence is, it makes it very difficult to include behaviours that are not pattern-based (generally requiring some form of T&E, be it for a human solver or a machine), e.g.:
- finding resolution paths with few steps;
- writing variants of rules that require additional, situation-dependent checks (e.g. checking some additional contradictions in non-J exocets).
.