Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-4849

SudokuExample cannot solve hard samples any more in Drools 7

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.31.0.Final
    • 7.30.0.Final
    • None
    • 2022 Week 44-46 (from Oct 31)
    • 2
      1. Download Drools 7.x
      2. Run the examples
      3. Pick Sudoku
      4. Open File > Samples > Hard <1,2,3,4>
      5. Click Solve
    • Interactive Demo/Tutorial
    • NEW
    • NEW

      It appears SudokuExample is capable to resolve the Simple and Medium samples, but none of the Hard ones. They resolve a few cells but end with

      Sorry - can't solve this grid.

      in the console.

      With explain = true, I can see that the "single" and "hidden single" rules fire (not always both, depends on the puzzle), but clearly when it stops, at least the latter should still fire for some cells.

      There is also a small bug in the code, which is that the unsolvable flag is not reset during setup, so when you get the above error you also get it for any other example you solve afterwards.

      I have checked with Drools 6.5.0.Final (checked out the examples from GitHub) and the solver works fine. The Sudoku example appears to be mostly the same though.

      I am running the examples with Java 8 from IntelliJ or command line, if that matters. I tested this on 2 different machines.

      It is a bit unfortunate because it is the first example in the GUI.

      Full console output for sample Hard 1:

      12:14:28.256 [main] INFO  o.d.c.k.b.impl.ClasspathKieProject.notifyKieModuleFound:133 - Found kmodule: file:/C:/Users/Public/Documents/projects/drools/drools-examples/target/classes/META-INF/kmodule.xml
      12:14:30.424 [main] WARN  o.d.c.k.b.impl.ClasspathKieProject.getPomPropertiesFromFileSystem:322 - Unable to find pom.properties in /C:/Users/Public/Documents/projects/drools/drools-examples/target/classes
      12:14:30.475 [main] INFO  o.d.c.k.b.impl.ClasspathKieProject.generatePomPropertiesFromPom:354 - Recursed up folders, found and used pom.xml C:\Users\Public\Documents\projects\drools\drools-examples\pom.xml
      12:14:42.619 [AWT-EventQueue-0] WARN  o.d.c.k.builder.impl.KieBuilderImpl.packageNameForFile:394 - File 'org/drools/games/wumpus/server/paintCave.drl' is in folder 'org/drools/games/wumpus/server' but declares package 'org.drools.games.wumpus.server.view'. It is advised to have a correspondance between package and folder names.
      12:14:42.632 [AWT-EventQueue-0] WARN  o.d.c.k.builder.impl.KieBuilderImpl.packageNameForFile:394 - File 'org/drools/games/wumpus/server/paintSensor.drl' is in folder 'org/drools/games/wumpus/server' but declares package 'org.drools.games.wumpus.server.view'. It is advised to have a correspondance between package and folder names.
      12:14:42.687 [AWT-EventQueue-0] WARN  o.d.c.k.builder.impl.KieBuilderImpl.packageNameForFile:394 - File 'org/drools/games/wumpus/server/ui.drl' is in folder 'org/drools/games/wumpus/server' but declares package 'org.drools.games.wumpus.server.view'. It is advised to have a correspondance between package and folder names.
      Validation complete.
             Col: 0     Col: 1     Col: 2     Col: 3     Col: 4     Col: 5     Col: 6     Col: 7     Col: 8     
      Row 0:   2 4  7 9   2 4 6        4 67 9   23  6  9  --- 5 ---  --- 1 ---    3  67 9  --- 8 ---     4 67   
      Row 1:  12    7 9  --- 8 ---  1    67 9   23  6  9  --- 4 ---   23  6     1 3  67 9    3  67 9  --- 5 --- 
      Row 2:  1  4    9  1  456     --- 3 ---       6 89  --- 7 ---       6 8   --- 2 ---     4 6  9  1  4 6    
      Row 3:  1234       1234       1  4       1   5  8   --- 6 ---      5 78       5 7       45 7    --- 9 --- 
      Row 4:  --- 6 ---  --- 7 ---  --- 5 ---  --- 4 ---  --- 2 ---  --- 9 ---  --- 8 ---  --- 1 ---  --- 3 --- 
      Row 5:  --- 8 ---  12 4       1  4    9  1   5      --- 3 ---      5 7        567       4567     2 4 67   
      Row 6:  1 3   7    1 3  6     --- 2 ---    3 56     --- 8 ---    3 56     --- 4 ---    3 567 9  1    67   
      Row 7:  --- 5 ---  1 34 6     1  4 678     3  6     --- 9 ---    34 6     1 3  67    --- 2 ---  1    678  
      Row 8:    34       --- 9 ---     4 6 8   --- 7 ---  --- 1 ---   23456       3 56       3 56          6 8  
      
      Sorry - can't solve this grid.
      

              rhn-support-tkobayas Toshiya Kobayashi
              didierloiseau Didier Loiseau (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: