[rules-users] Purpose of difficultyWeightFactoryClass in @PlanningEntity annotation.

Reinis drools at orbit-x.de
Mon Jan 7 16:04:57 EST 2013


Hello Michiel,

 >I thought it was used to indicate which PlanningEntities to handle 
first in order to get faster to a solution.

To my understanding this is not quite true. DifficultyWeight defines 
what Entities will likely be more difficult to plan, period.

What is actually DONE with this statement (of difficulty) is decided by 
meta heuristics algorithm and/or by different selectors (not sure about 
this one though). What I am saying
- difficulty weight just says "yo, dude, this planning entity is 
hard/easy to plan"
- meta heuristics algorithm (also construction heuristics) then say "oh 
great, then I start with easy ones" or "oh dude, then I get first down 
to hard ones" or even "nice, but I don't give a damn about difficulty 
whatdoyaknow"

*assumption mode on*
The reason why you all of the sudden get negative hard score MIGHT be 
that the "right" entities are falling out of the selection. And this is 
controlled by meta heuristics algorithm.

As I understand all the meta heuristics magic - it can solve problems 
with the space of 10^650 because... it cheats! Yes, it does not evaluate 
ALL of the possible values (entities or planning variables) but selects 
a subset of those (the ones likely to yield a solution).

And one more thought - changing difficulty weight calculation (in 
factory) should normaly NOT have such a drastic influence on score (up 
to now I used difficulty weight calcs to increase performance). So I am 
suggesting here that the issue MAY lay some other place (typical would 
be local optima).
*assumption mode off*

In drools planner docs there is some decent information on selection of 
stuff. If I may suggest, start with construction heuristic types and 
check out the docs where it says what BEST_FIT or, respectively, 
BEST_FIT_DECREASING does.

I hope I could at least give you couple of ideas on where to proceed 
with the issue.

br
Reinis

On 01/07/2013 09:26 PM, Michiel Vermandel wrote:
> Hi,
>
> I am struggling with the purpose of difficultyWeightFactoryClass in 
> the @PlanningEntity annotation.
>
> I thought it was used to indicate which PlanningEntities to handle 
> first in order to get faster to a solution.
> Though it seems that it also has impact on whether or not to get to a 
> zero-hardscore solution.
> I mean I have a testcase that resolves to a zero-hardscore solution.
> Then I change something small in how the difficultyWeightFactoryClass 
> calculates the weight and all the sudden I get a negative-hardscore 
> solution.
> I thought it would still get to the same zero-hardscore solution but 
> in a shorter solving time.
>
> My solver termination is as follows:
>
> <termination>
> <terminationCompositionStyle>OR</terminationCompositionStyle>
> <maximumSecondsSpend>3600</maximumSecondsSpend>
> <scoreAttained>0hard/0soft</scoreAttained>
>     </termination>
>
> and constructionHeuristic:
>
> <constructionHeuristic>
> <constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType>
>     </constructionHeuristic>
>
> I do not reach a zero-hardscore and the time spent is about 2.8 seconds...
>
> If I read the best solution I get:
> .isEveryProblemFactChangeProcessed(): true
> .isTerminateEarly(): false
>
> Any idea why I do not get a zero-hardscore solution anymore when only 
> making a small change to the difficultyWeightFactoryClass logic?
>
> Thanks
>
> Michiel.
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users



More information about the rules-users mailing list