<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>&nbsp;</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">&lt;ge0ffrey.spam@gmail.com&gt;</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">&lt;rules-users@lists.jboss.org&gt;</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, &lt;constructionHeuristics&gt; don't
            result into an <br>
            optimal solution.<br>
            You need to do &lt;localSearch&gt; 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>
            &gt; Hello Michiel,<br>
            &gt;<br>
            &gt;&nbsp; &gt;I thought it was used to indicate which
            PlanningEntities to handle<br>
            &gt; first in order to get faster to a solution.<br>
            &gt;<br>
            &gt; To my understanding this is not quite true.
            DifficultyWeight defines<br>
            &gt; what Entities will likely be more difficult to plan,
            period.<br>
            &gt;<br>
            &gt; What is actually DONE with this statement (of
            difficulty) is decided by<br>
            &gt; meta heuristics algorithm and/or by different selectors
            (not sure about<br>
            &gt; this one though). What I am saying<br>
            &gt; - difficulty weight just says "yo, dude, this planning
            entity is<br>
            &gt; hard/easy to plan"<br>
            &gt; - meta heuristics algorithm (also construction
            heuristics) then say "oh<br>
            &gt; great, then I start with easy ones" or "oh dude, then I
            get first down<br>
            &gt; to hard ones" or even "nice, but I don't give a damn
            about difficulty<br>
            &gt; whatdoyaknow"<br>
            &gt;<br>
            &gt; *assumption mode on*<br>
            &gt; The reason why you all of the sudden get negative hard
            score MIGHT be<br>
            &gt; that the "right" entities are falling out of the
            selection. And this is<br>
            &gt; controlled by meta heuristics algorithm.<br>
            &gt;<br>
            &gt; As I understand all the meta heuristics magic - it can
            solve problems<br>
            &gt; with the space of 10^650 because... it cheats! Yes, it
            does not evaluate<br>
            &gt; ALL of the possible values (entities or planning
            variables) but selects<br>
            &gt; a subset of those (the ones likely to yield a
            solution).<br>
            &gt;<br>
            &gt; And one more thought - changing difficulty weight
            calculation (in<br>
            &gt; factory) should normaly NOT have such a drastic
            influence on score (up<br>
            &gt; to now I used difficulty weight calcs to increase
            performance). So I am<br>
            &gt; suggesting here that the issue MAY lay some other place
            (typical would<br>
            &gt; be local optima).<br>
            &gt; *assumption mode off*<br>
            &gt;<br>
            &gt; In drools planner docs there is some decent information
            on selection of<br>
            &gt; stuff. If I may suggest, start with construction
            heuristic types and<br>
            &gt; check out the docs where it says what BEST_FIT or,
            respectively,<br>
            &gt; BEST_FIT_DECREASING does.<br>
            &gt;<br>
            &gt; I hope I could at least give you couple of ideas on
            where to proceed<br>
            &gt; with the issue.<br>
            &gt;<br>
            &gt; br<br>
            &gt; Reinis<br>
            &gt;<br>
            &gt; On 01/07/2013 09:26 PM, Michiel Vermandel wrote:<br>
            &gt;&gt; Hi,<br>
            &gt;&gt;<br>
            &gt;&gt; I am struggling with the purpose of
            difficultyWeightFactoryClass in<br>
            &gt;&gt; the @PlanningEntity annotation.<br>
            &gt;&gt;<br>
            &gt;&gt; I thought it was used to indicate which
            PlanningEntities to handle<br>
            &gt;&gt; first in order to get faster to a solution.<br>
            &gt;&gt; Though it seems that it also has impact on whether
            or not to get to a<br>
            &gt;&gt; zero-hardscore solution.<br>
            &gt;&gt; I mean I have a testcase that resolves to a
            zero-hardscore solution.<br>
            &gt;&gt; Then I change something small in how the
            difficultyWeightFactoryClass<br>
            &gt;&gt; calculates the weight and all the sudden I get a
            negative-hardscore<br>
            &gt;&gt; solution.<br>
            &gt;&gt; I thought it would still get to the same
            zero-hardscore solution but<br>
            &gt;&gt; in a shorter solving time.<br>
            &gt;&gt;<br>
            &gt;&gt; My solver termination is as follows:<br>
            &gt;&gt;<br>
            &gt;&gt; &lt;termination&gt;<br>
            &gt;&gt;
&lt;terminationCompositionStyle&gt;OR&lt;/terminationCompositionStyle&gt;<br>
            &gt;&gt;
            &lt;maximumSecondsSpend&gt;3600&lt;/maximumSecondsSpend&gt;<br>
            &gt;&gt;
            &lt;scoreAttained&gt;0hard/0soft&lt;/scoreAttained&gt;<br>
            &gt;&gt;&nbsp; &nbsp; &nbsp; &lt;/termination&gt;<br>
            &gt;&gt;<br>
            &gt;&gt; and constructionHeuristic:<br>
            &gt;&gt;<br>
            &gt;&gt; &lt;constructionHeuristic&gt;<br>
            &gt;&gt;
&lt;constructionHeuristicType&gt;BEST_FIT_DECREASING&lt;/constructionHeuristicType&gt;<br>
            &gt;&gt;&nbsp; &nbsp; &nbsp; &lt;/constructionHeuristic&gt;<br>
            &gt;&gt;<br>
            &gt;&gt; I do not reach a zero-hardscore and the time spent
            is about 2.8 seconds...<br>
            &gt;&gt;<br>
            &gt;&gt; If I read the best solution I get:<br>
            &gt;&gt; .isEveryProblemFactChangeProcessed(): true<br>
            &gt;&gt; .isTerminateEarly(): false<br>
            &gt;&gt;<br>
            &gt;&gt; Any idea why I do not get a zero-hardscore solution
            anymore when only<br>
            &gt;&gt; making a small change to the
            difficultyWeightFactoryClass logic?<br>
            &gt;&gt;<br>
            &gt;&gt; Thanks<br>
            &gt;&gt;<br>
            &gt;&gt; Michiel.<br>
            &gt;&gt; -----------------<br>
            &gt;&gt; <a moz-do-not-send="true"
              href="http://www.codessentials.com/" target="_blank">http://www.codessentials.com</a>
            - Your essential software, for free!<br>
            &gt;&gt; Follow us at <a moz-do-not-send="true"
              href="http://twitter.com/#%21/Codessentials"
              target="_blank">http://twitter.com/#!/Codessentials</a><br>
            &gt;&gt;<br>
            &gt;&gt;<br>
            &gt;&gt; _______________________________________________<br>
            &gt;&gt; rules-users mailing list<br>
            &gt;&gt; <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>
            &gt;&gt; <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>
            &gt; _______________________________________________<br>
            &gt; rules-users mailing list<br>
            &gt; <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>
            &gt; <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>
            &gt;<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>