Solving Sudoku via Production Rules
I'm trying to solve any Sudoku puzzle using production rules, with Drools as my inference engine. One of the examples packed with Drools is precisely a Sudoku solver, here are the relevant rules:
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/sudoku/sudokuSolver.drl
... But it doesn't work right. All of the time, one or more cells in the grid end up empty and the program reports the puzzle as "unsolved".
Has anybody built a working inference rule-based solver for Sudoku? it doesn't matter the language or engine used, I would like to see the set of rules so that I can a开发者_开发技巧dapt them for Drools
There's a sudoku solver written in CLIPS here: https://sourceforge.net/p/clipsrules/code/HEAD/tree/branches/63x/examples/sudoku/
Don't use trunk (master on github now), as that's unstable. Use the latest release from the download page. Apparently this example's been broken already in the 5.1 release, so you'd need the 5.0 release... Here's the issue, it might be solved for 5.2.0.M1 which will be released any day now, otherwise later.
精彩评论