<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt">Hi Geoffrey,<br><br>Thanks for your answer. It is quite clear now :-)<br>&gt;You might look into all this and feel like it's black magic,
    lowering your thrust in it.<br>My thrust in it is not lowering, to the contrary.<br>Bit by bit I start to understand the magic and it is getting less black ;-)<br><br>Thanks for all your advice.<br><br>Regards,<br><br>Michiel <br><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: arial, helvetica, sans-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 &lt;ge0ffrey.spam@gmail.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Rules Users List &lt;rules-users@lists.jboss.org&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, January 30, 2013 11:10 AM<br> <b><span style="font-weight:
 bold;">Subject:</span></b> Re: [rules-users] Question about caching of MoveListFactory<br> </font> </div> <br>
<div id="yiv1762602422">
  

    
  
  <div>
    <br>
    <div class="yiv1762602422moz-cite-prefix">Op 30-01-13 10:41, Michiel Vermandel
      schreef:<br>
    </div>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div>Hi,</div>
        <div><br>
        </div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">Is it possible to use
          caching on a custom created MoveListFactory?</div>
      </div>
    </blockquote>
    yes, use PHASE caching.<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><br>
        </div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">I mean, I created a custom
          MoveListFactory and configured it like this:</div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><br>
        </div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
          &lt;moveListFactory&gt;<br>
        </div>
      </div>
    </blockquote>
    &lt;cacheType&gt;PHASE&lt;/&gt;<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;moveListFactoryClass&gt;my.planner.solver.ProjectShiftFactory&lt;/moveListFactoryClass&gt;<br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/moveListFactory&gt;</div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><br>
        </div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">I noticed that the
          createMoveList method is called upon every step.</div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">Though, if I get things
          right, in the case that the step did not result in a better
          score, the solution will not be cloned and thus (in my case)
          the <br>
        </div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">calling of the
          createMoveList in the next step will result in exactly the
          same list containing the same object instances.</div>
      </div>
    </blockquote>
    Cloning doesn't impact it either. The working solution instance
    doesn't change: it's the best solution instance that gets replaced
    by a clone, but the MoveListFactory is based on the working
    solution.<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><br>
        </div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">I think it would be OK if
          the createMoveListis only called when a better score is
          reached and a cloneSolution will be executed (and thus my
          object instances get obsolete).</div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">1) I hope my theory makes
          sense end if so my question is: can I cache the list on the
          level as described?</div>
      </div>
    </blockquote>
    yes, see above<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><br>
        </div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">2) One more question about
          steps: if a step does not result in a better score, what
          happens then? <br>
        </div>
      </div>
    </blockquote>
    it's still taken, as it might lead out of a local optima.<br>
    See why hill climbing is bad and tabu search isn't.<br>
&nbsp;http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e6264<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">- A new number of moves is
          launched up to the limit defined by minimalAcceptedSelection?</div>
      </div>
    </blockquote>
    Looking though all possible moves doesn't scale with more than 100
    entities * 100 values, so we look through a random subset of all
    moves (minimalAcceptedSelection)<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">But what is the difference
          with the previous step?</div>
      </div>
    </blockquote>
    It always starts from a different solution: the step is always taken
    (even if it's worse - in fact Sim Ann, Late acceptance and to lesser
    degree Tabu Search heavily need this).<br>
    And it's uses a different random subset to evaluate
    (minimalAcceptedSelection).<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">Is it the fact that a
          "different" solution with the same score will be used as
          starting point of the new step (given that one uses tabu)?<br>
        </div>
      </div>
    </blockquote>
    <br>
    You might look into all this and feel like it's black magic,
    lowering your thrust in it.<br>
    In that case, take a look at how many possible solutions your
    problem has, to put things in perspective.<br>
    Usually it is: valueSize to the power entitySize. (docs on master
    have numbers on this in the "use cases" section)<br>
    These planning problems are NP complete, which means that there's no
    software on this planet which solves them optimally and scales.<br>
    Research competitions with real-world cases (roadef, ITC2007, ...)
    clearly show that metaheuristics work best and most reliable,
    heavily outperforming all other techniques (including human
    planners).<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><br>
        </div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><br>
        </div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">Thanks,</div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><br>
        </div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">Michiel</div>
        <div>&nbsp;</div>
        <div>-----------------<br>
          http://www.codessentials.com - Your essential software, for
          free!<br>
          Follow us at http://twitter.com/#!/Codessentials<span class="yiv1762602422tab">&nbsp;&nbsp;&nbsp; </span><br>
          <span class="yiv1762602422tab">&nbsp;&nbsp;&nbsp; </span><br>
          <span class="yiv1762602422tab">&nbsp;&nbsp;&nbsp; </span><br>
          <span class="yiv1762602422tab">&nbsp;&nbsp;&nbsp; <br>
          </span></div>
      </div>
      <br>
      <fieldset class="yiv1762602422mimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
rules-users mailing list
<a rel="nofollow" class="yiv1762602422moz-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="yiv1762602422moz-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>