<html><body><div style="color:#000; background-color:#fff; font-family:tahoma, new york, times, serif;font-size:10pt"><div><span>></span> Unless you don't have a <localSearch> configuration of course.</div><div>Indeed, somewhere during my testing and trying to figure out what the use of each configuration part is, I stripped out the local search part.<br>Never noticed it because I always got zero score so far... <br><br>Ok, on to localSearch.<br><br>Thanks!<br><br></div><div>-----------------<br>http://www.codessentials.com - Your essential software, for free!<br>Follow us at http://twitter.com/#!/Codessentials<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 <ge0ffrey.spam@gmail.com><br>
<b><span style="font-weight: bold;">To:</span></b> Rules Users List <rules-users@lists.jboss.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Tuesday, January 8, 2013 11:29 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] Purpose of difficultyWeightFactoryClass in @PlanningEntity annotation.<br> </font> </div> <br>
<div id="yiv2096281102">
<div>
<br>
<div class="yiv2096281102moz-cite-prefix">Op 08-01-13 11:12, Geoffrey De Smet
schreef:<br>
</div>
<blockquote type="cite">
<br>
<div class="yiv2096281102moz-cite-prefix">Op 08-01-13 10:23, Michiel Vermandel
schreef:<br>
</div>
<blockquote 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>
</blockquote>
Unless you don't have a <localSearch> configuration of course.<br>
The <constructionHeuristics> don't run forever: they stop
fairly fast.<br>
Giving them more time is pointless.<br>
See manual section "Termination" and "SolverPhase".<br>
<blockquote type="cite"> <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 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>
http://www.codessentials.com
- Your essential software, for free!<br>
Follow us at http://twitter.com/#%21/Codessentials<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 rel="nofollow" class="yiv2096281102moz-txt-link-rfc2396E" ymailto="mailto:ge0ffrey.spam@gmail.com" target="_blank" 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 rel="nofollow" class="yiv2096281102moz-txt-link-rfc2396E" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" 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 rel="nofollow" target="_blank" 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">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>
http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e6076<br>
With difficultyWeight (the result of FFD is statistically
better than FF):<br>
http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e6126<br>
DifficultyWeight details:<br>
http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#planningEntityDifficulty<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 rel="nofollow" target="_blank" href="http://www.codessentials.com/">http://www.codessentials.com</a>
- Your essential software, for free!<br>
>> Follow us at <a rel="nofollow" target="_blank" href="http://twitter.com/#%21/Codessentials">http://twitter.com/#!/Codessentials</a><br>
>><br>
>><br>
>> _______________________________________________<br>
>> rules-users mailing list<br>
>> <a rel="nofollow" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> <a rel="nofollow" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
> _______________________________________________<br>
> rules-users mailing list<br>
> <a rel="nofollow" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> <a rel="nofollow" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a rel="nofollow" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a rel="nofollow" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br>
<br>
</div>
</div>
</div>
<br>
<fieldset class="yiv2096281102mimeAttachmentHeader"></fieldset>
<br>
<pre>_______________________________________________
rules-users mailing list
<a rel="nofollow" class="yiv2096281102moz-txt-link-abbreviated" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a rel="nofollow" class="yiv2096281102moz-txt-link-freetext" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
<br>
<fieldset class="yiv2096281102mimeAttachmentHeader"></fieldset>
<br>
<pre>_______________________________________________
rules-users mailing list
<a rel="nofollow" class="yiv2096281102moz-txt-link-abbreviated" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a rel="nofollow" class="yiv2096281102moz-txt-link-freetext" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</div>
</div><br>_______________________________________________<br>rules-users mailing list<br><a ymailto="mailto:rules-users@lists.jboss.org" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a 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></body></html>