<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">Op 08-01-13 10:23, Michiel Vermandel
schreef:<br>
</div>
<blockquote
cite="mid:1357636984.13027.YahooMailNeo@web161305.mail.bf1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff; font-family:tahoma,
new york, times, serif;font-size:10pt">Many thanks Geoffrey and
Reinis for the advice and directions.<br>
<br>
One more question: is it possible that the solver stops in 2.8
seconds with a negative score solution even the termination
config says hardscore 0 OR 3600 seconds?<br>
</div>
</blockquote>
No, presuming that that's a negative hardscore.<br>
<br>
Does Solver.solve() throw an exception?<br>
If not, what does the logging say? If that doesn't say anything,
enable INFO or DEBUG logging (see manual).<br>
<blockquote
cite="mid:1357636984.13027.YahooMailNeo@web161305.mail.bf1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff; font-family:tahoma,
new york, times, serif;font-size:10pt">Or do I have something
wrong?<br>
Or is it the local search that will be cut off?<br>
<br>
Thanks<br>
<br>
Michiel<br>
<div><span><br>
</span></div>
<div> </div>
<div>-----------------<br>
<a class="moz-txt-link-freetext" href="http://www.codessentials.com">http://www.codessentials.com</a> - Your essential software, for
free!<br>
Follow us at <a class="moz-txt-link-freetext" href="http://twitter.com/#!/Codessentials">http://twitter.com/#!/Codessentials</a><br>
</div>
<div style="font-family: tahoma, new york, times, serif;
font-size: 10pt;">
<div style="font-family: times new roman, new york, times,
serif; font-size: 12pt;">
<div dir="ltr"> <font face="Arial" size="2">
<hr size="1"> <b><span style="font-weight:bold;">From:</span></b>
Geoffrey De Smet <a class="moz-txt-link-rfc2396E" href="mailto:ge0ffrey.spam@gmail.com"><ge0ffrey.spam@gmail.com></a><br>
<b><span style="font-weight: bold;">To:</span></b> Rules
Users List <a class="moz-txt-link-rfc2396E" href="mailto:rules-users@lists.jboss.org"><rules-users@lists.jboss.org></a> <br>
<b><span style="font-weight: bold;">Sent:</span></b>
Tuesday, January 8, 2013 8:32 AM<br>
<b><span style="font-weight: bold;">Subject:</span></b>
Re: [rules-users] Purpose of
difficultyWeightFactoryClass in @PlanningEntity
annotation.<br>
</font> </div>
<br>
Some extra info, on top of Reinis's excellent advice:<br>
Take a look at this image:<br>
<a moz-do-not-send="true"
href="https://hudson.jboss.org/hudson/view/Drools%20jBPM/job/drools-planner/lastSuccessfulBuild/artifact/drools-planner-docs/target/docbook/publish/en-US/html_single/images/Chapter-Optimization_algorithms/generalPhaseSequence.png"
target="_blank">https://hudson.jboss.org/hudson/view/Drools%20jBPM/job/drools-planner/lastSuccessfulBuild/artifact/drools-planner-docs/target/docbook/publish/en-US/html_single/images/Chapter-Optimization_algorithms/generalPhaseSequence.png</a><br>
As the image shows, <constructionHeuristics> don't
result into an <br>
optimal solution.<br>
You need to do <localSearch> after it too.<br>
Oversimplifiedly speaking, Construction heuristics are fast
and brittle, <br>
Local Search is slow and robust.<br>
<br>
Only construction heuristics *_FIT_DECREASING use <br>
difficultyWeightFactoryClass.<br>
By giving a better estimation of the planning difficulty of
a entity, <br>
the construction heuristics perform better and Local Search
has to do <br>
less work for the same result.<br>
<br>
Read these sections in the manual:<br>
Without difficultyWeight:<br>
<a class="moz-txt-link-freetext" href="http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e6076">http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e6076</a><br>
With difficultyWeight (the result of FFD is statistically
better than FF):<br>
<a class="moz-txt-link-freetext" href="http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e6126">http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e6126</a><br>
DifficultyWeight details:<br>
<a class="moz-txt-link-freetext" href="http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#planningEntityDifficulty">http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#planningEntityDifficulty</a><br>
<br>
Op 07-01-13 22:04, Reinis schreef:<br>
> Hello Michiel,<br>
><br>
> >I thought it was used to indicate which
PlanningEntities to handle<br>
> first in order to get faster to a solution.<br>
><br>
> To my understanding this is not quite true.
DifficultyWeight defines<br>
> what Entities will likely be more difficult to plan,
period.<br>
><br>
> What is actually DONE with this statement (of
difficulty) is decided by<br>
> meta heuristics algorithm and/or by different selectors
(not sure about<br>
> this one though). What I am saying<br>
> - difficulty weight just says "yo, dude, this planning
entity is<br>
> hard/easy to plan"<br>
> - meta heuristics algorithm (also construction
heuristics) then say "oh<br>
> great, then I start with easy ones" or "oh dude, then I
get first down<br>
> to hard ones" or even "nice, but I don't give a damn
about difficulty<br>
> whatdoyaknow"<br>
><br>
> *assumption mode on*<br>
> The reason why you all of the sudden get negative hard
score MIGHT be<br>
> that the "right" entities are falling out of the
selection. And this is<br>
> controlled by meta heuristics algorithm.<br>
><br>
> As I understand all the meta heuristics magic - it can
solve problems<br>
> with the space of 10^650 because... it cheats! Yes, it
does not evaluate<br>
> ALL of the possible values (entities or planning
variables) but selects<br>
> a subset of those (the ones likely to yield a
solution).<br>
><br>
> And one more thought - changing difficulty weight
calculation (in<br>
> factory) should normaly NOT have such a drastic
influence on score (up<br>
> to now I used difficulty weight calcs to increase
performance). So I am<br>
> suggesting here that the issue MAY lay some other place
(typical would<br>
> be local optima).<br>
> *assumption mode off*<br>
><br>
> In drools planner docs there is some decent information
on selection of<br>
> stuff. If I may suggest, start with construction
heuristic types and<br>
> check out the docs where it says what BEST_FIT or,
respectively,<br>
> BEST_FIT_DECREASING does.<br>
><br>
> I hope I could at least give you couple of ideas on
where to proceed<br>
> with the issue.<br>
><br>
> br<br>
> Reinis<br>
><br>
> On 01/07/2013 09:26 PM, Michiel Vermandel wrote:<br>
>> Hi,<br>
>><br>
>> I am struggling with the purpose of
difficultyWeightFactoryClass in<br>
>> the @PlanningEntity annotation.<br>
>><br>
>> I thought it was used to indicate which
PlanningEntities to handle<br>
>> first in order to get faster to a solution.<br>
>> Though it seems that it also has impact on whether
or not to get to a<br>
>> zero-hardscore solution.<br>
>> I mean I have a testcase that resolves to a
zero-hardscore solution.<br>
>> Then I change something small in how the
difficultyWeightFactoryClass<br>
>> calculates the weight and all the sudden I get a
negative-hardscore<br>
>> solution.<br>
>> I thought it would still get to the same
zero-hardscore solution but<br>
>> in a shorter solving time.<br>
>><br>
>> My solver termination is as follows:<br>
>><br>
>> <termination><br>
>>
<terminationCompositionStyle>OR</terminationCompositionStyle><br>
>>
<maximumSecondsSpend>3600</maximumSecondsSpend><br>
>>
<scoreAttained>0hard/0soft</scoreAttained><br>
>> </termination><br>
>><br>
>> and constructionHeuristic:<br>
>><br>
>> <constructionHeuristic><br>
>>
<constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType><br>
>> </constructionHeuristic><br>
>><br>
>> I do not reach a zero-hardscore and the time spent
is about 2.8 seconds...<br>
>><br>
>> If I read the best solution I get:<br>
>> .isEveryProblemFactChangeProcessed(): true<br>
>> .isTerminateEarly(): false<br>
>><br>
>> Any idea why I do not get a zero-hardscore solution
anymore when only<br>
>> making a small change to the
difficultyWeightFactoryClass logic?<br>
>><br>
>> Thanks<br>
>><br>
>> Michiel.<br>
>> -----------------<br>
>> <a moz-do-not-send="true"
href="http://www.codessentials.com/" target="_blank">http://www.codessentials.com</a>
- Your essential software, for free!<br>
>> Follow us at <a moz-do-not-send="true"
href="http://twitter.com/#%21/Codessentials"
target="_blank">http://twitter.com/#!/Codessentials</a><br>
>><br>
>><br>
>> _______________________________________________<br>
>> rules-users mailing list<br>
>> <a moz-do-not-send="true"
ymailto="mailto:rules-users@lists.jboss.org"
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> <a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
> _______________________________________________<br>
> rules-users mailing list<br>
> <a moz-do-not-send="true"
ymailto="mailto:rules-users@lists.jboss.org"
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> <a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a moz-do-not-send="true"
ymailto="mailto:rules-users@lists.jboss.org"
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br>
<br>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</body>
</html>