[rules-users] Why is solving a partial puzzle much slower than generating one from scratch?

Geoffrey De Smet ge0ffrey.spam at gmail.com
Tue Jan 31 10:19:32 EST 2012



Op 31-01-12 16:12, aitchnyu schreef:
> I am making a 3x3 Sudoku solver with Drools planner. The planning entities
> are the digits. The problem facts are the rows (planning variable) and
> columns.
>
> When I set Drools Planner to solve a problem where no digit is initialized,
> it gives a perfect solution in ~15 secs. But when I set a few digits as
> initialized, it never finds a solution.  It always lists 8 hard constraints
> broken on termination.
>
> I implemented the moves as:
>
> if(digit.getFixed()==false){
>      moveList.add(new RowChangeMove(digit, toRow));
Presuming that your 3x3 looks like this

row1, col1 | row1, col2 | row 1 col3
row2, col1 | row2, col2 | row 2 col3
row3, col1 | row3, col2 | row 3 col3

So when digit 4 starts on row1, col1
it can only move to row2, col1 and row3, col1
but never any of the 6 other points in col2 and col3?
> }
> If the digit is fixed, dont make a move object for it.
>
> Earlier, I implemented it in isMoveDoable: if the digit.getFixed() is true,
> it returns false. Both do not work.
>
> 20:31:13.442 [main] INFO  o.d.p.c.l.DefaultLocalSearchSolverPhase - Phase
> local search finished: step total (978), time spend (60061), best score
> (-8).
> 20:31:13.442 [main] INFO  o.d.p.core.solver.DefaultSolver - Solved: time
> spend (60061), best score (-8), average calculate count per second (7433).
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Why-is-solving-a-partial-puzzle-much-slower-than-generating-one-from-scratch-tp3703622p3703622.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>

-- 
With kind regards,
Geoffrey De Smet





More information about the rules-users mailing list