[rules-users] Drools Planner - Constraint Occurrences in working memory

Geoffrey De Smet ge0ffrey.spam at gmail.com
Tue Apr 20 14:17:35 EDT 2010


Yes, the last iteration stays in the working memory.
Putting the best solution into the working memory at the end is waisting 
CPU I believe.
Feel free to open an issue (and link it here) that the solver should 
dispose the working memory after solving, so no one thinks that it 
actually holds the best solution.

1) What you can do, is the same thing I do in my examples: grab the 
rulebase and put the best solution into it. Just copy&paste from the 
examples.

I also have an open issue that you can supply the rulebase yourself
instead having to configure it with <scoreDrl> entry's.

2) An alternative is to define your own score implementation, but that's 
a lot harder (I am going to refactor out ScoreCalculator to make that 
easier).

With kind regards,
Geoffrey De Smet


awuttke schreef:
> Hello,
> 
> let's assume I have a planning problem and the planner cannot find an
> optimal solution. The best score was found some iterations back and the
> planner stops due to it's configuration (e.g.
> <maximumUnimprovedStepCount>50</maximumUnimprovedStepCount>).
> 
> When calling getBestScore() I get the best score of all iterations. But how
> can I retrieve the corresponding constraint occurrences that explain how
> this score was calculated?
> 
> When retrieving the ConstraintOccurrence from the working memory using
> localSearchSolverScope.getWorkingMemory() I can only find
> ConstraintOccurrence objects that probably match to the last iteration
> executed but not the ConstraintOccuerence objects matching the best score.
> 
> Does the planner keep these best score ConstraintOccurrence objects in a
> different place? If yes, how can they be retrieved?
> 
> Thank you,
> Andreas




More information about the rules-users mailing list