<html><body><div style="color:#000; background-color:#fff; font-family:tahoma, new york, times, serif;font-size:10pt">Hey, <br><br>Thank you James for your response.<br>I manage to solve a 324 tasks for 71 candidate technicians in 11 periods in less than 10 minutes.<br>I did not do much of optimization yet, as I need to look into that part. My knowledge about selectors and tabu-searches and heuristics is still far to limited.<br>The main effort I made is enhancing the algorithm to give a weight to the planning-enitities (Tasks) and technicians.<br>It did not seem to influence the solve-time that much, though it had major impact on the final score.<br>I have no idea why solving sometimes stops before 3600 seconds if hard-score is less than 0.<br><br>This is my termination config:<br><br>&nbsp; &lt;termination&gt;<br>&nbsp;&nbsp;&nbsp; &lt;maximumSecondsSpend&gt;3600&lt;/maximumSecondsSpend&gt;<br>&nbsp;&nbsp;&nbsp;
 &lt;scoreAttained&gt;0hard/-999999soft&lt;/scoreAttained&gt;<br>&nbsp; &lt;/termination&gt; <br><br><div><span>But as POC (proof of concept) I guess I achieved my goal.</span></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;">One unanswered question from my previous mail:</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;">While rules are running: why do I get planningentities with uninitialized planningvariables (null)?</div><div
 style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;">If "Task" is the planningentity and period is a planningvariable I need to put:</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;">&nbsp;&nbsp;&nbsp; $task : Task(period != null, ... whatever)</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size:
 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;">Else the rule is executed with period is null, which results in all sorts of trouble, especially when using this planning variable in 'not equals' comparison.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;">Example of such rule which needs not-null checking:</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;">rule
 "tasksInSameJobMustBeInSamePeriod"<br>&nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $taskA : Task(period!=null, $id : id, $jobId : jobId, $periodId : periodId )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $taskB : Task(period!=null, id &gt; $id, jobId == $jobId, periodId != $periodId )<br>&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; insertLogical(new IntConstraintOccurrence("tasksInSameJobMustBeInSamePeriod",&nbsp; $taskA, $taskB));<br>end <br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;">Without the (period!=null you get exceptions thrown complaining about constraints in excess.<br></div><div style="color: rgb(0, 0, 0); font-size:
 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;">Any ideas on why this is needed and if it is possible to never get nulls as planningvariable in the rules?<br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><span>Regards,</span></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style:
 normal;"><span>Michiel<br></span></div><div>&nbsp;</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> James Owen - North Texas &lt;jco@kbsc.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Michiel Vermandel &lt;mvermand@yahoo.com&gt;; Rules Users List &lt;rules-users@lists.jboss.org&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, September 6, 2012 4:30 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] Best model for planning? technicians, airplanes and shifts =&gt; insertLogical problems<br> </font> </div>
 <br><div id="yiv1927383168"><div>Greetings:<div><br></div><div>I started at the beginning of this thread and followed along (skipping only a one or two emails) and I was surprised that along the way that the problem grew and grew. &nbsp;There is an excellent discussion of this very situation in the seminal book on expert systems by Girratano and Riley (about chapter 5 or 6) on pattern matching wherein they discuss this very problem with matching multiple patterns of objects. &nbsp;When pattern matching it <u>does</u> matter&nbsp;<u>the order</u>&nbsp;in which you match the objects and their attributes because of the combinatorial explosion. &nbsp;You have only so much memory with which to work and, sooner or later, you will run out of memory. &nbsp;</div><div><br></div><div>You can't just throw all of the objects into a bucket willy-nilly and hope for the best results. &nbsp;The returned error may or may not be the one that you thought that it would be.
 &nbsp;500 planes or 1,000 planes matched against multiple tasks matched against 12 months matched against multiple weeks matched against multiple shifts matched against … Well, you get the idea. &nbsp;As the list expands, the possibilities expand by the number of possibilities against which it can be matched. &nbsp;The project has to be architected and broken up into proper "chunks" so that it can be digested properly. &nbsp;You don't eat a steak nor an apple in one bite. &nbsp;You take it one bite at a time and chew it slowly and carefully. &nbsp;So it is with a large problem.<div><br></div><div>Even virtual memory is limited and will die out, as I have seen it done with benchmarks and the WaltzDB benchmark when programmed poorly. &nbsp;When one more item is added to the problem space you must remember that the memory required expands exponentially ever upwards so it is always best to keep the requirements small at all times and move from small sets
 to small sets, even when you have GigaBytes of RAM these days. &nbsp;Even later when we have TeraBytes, good programming will still be required for good results.</div><div><br></div><div>BTW, it seems that the God Father of benchmarks, Dr. Daniel Miranker (formerly of CMU and now at UT Austin) will be speaking at Intellifest 2012 this year. &nbsp;Visit&nbsp;<a rel="nofollow" target="_blank" href="http://www.intellifest.org/">http://www.IntelliFest.org</a>&nbsp;for more details as they develop. &nbsp;They probably have a gathering of some of the best minds of AI this year if anyone would care to attend. &nbsp;Also, if anyone is looking for employment, they are planning on having recruiters there as well.<br><div><span class="yiv1927383168Apple-style-span" style="border-collapse:separate;color:rgb(0, 0, 0);font-family:'Times New
 Roman';font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;orphans:2;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;font-size:medium;"><span class="yiv1927383168Apple-style-span" style="border-collapse:separate;color:rgb(0, 0, 0);font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;orphans:2;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;font-size:medium;"><div><br class="yiv1927383168Apple-interchange-newline">Shalom</div><div>jco</div></span></span></div></div></div><div>
<span class="yiv1927383168Apple-style-span" style="border-collapse:separate;color:rgb(0, 0, 0);font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;orphans:2;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;font-size:medium;"><span class="yiv1927383168Apple-style-span" style="border-collapse:separate;color:rgb(0, 0, 0);font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;orphans:2;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;font-size:medium;"><div><br class="yiv1927383168Apple-interchange-newline"></div></span><br class="yiv1927383168Apple-interchange-newline"></span><br class="yiv1927383168Apple-interchange-newline">
</div>
<br><div><div>On Sep 3, 2012, at 7:31 AM, Michiel Vermandel wrote:</div><br class="yiv1927383168Apple-interchange-newline"><blockquote type="cite"><div><div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">Ok,<br><br>I changed <span><span>periodId &gt; $periodId back into <span><span>periodId != $periodId as I already discovered that this change resulted in invalid solutions.<br>Though, then I was back to the exception.<br><br>I now made another change which seems to be the solution... I think... I hope<br>Though, I do not understand the solution myself for 100%<br><br>What I did was testing if period is not null:<br><br>rule "tasksInSameJobMustBeInSamePeriod"<br>&nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $taskA : MaintenanceTask(<span style="font-weight:bold;">period!=null</span>, $id : id, $jobId : jobId, $periodId : periodId )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 $taskB : MaintenanceTask(<span style="font-weight:bold;">period!=null</span>, id &gt; $id, jobId == $jobId, periodId != $periodId
 )<br>&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; insertLogical(new IntConstraintOccurrence("tasksInSameJobMustBeInSamePeriod",&nbsp; $taskA, $taskB));<br>end <br><br>I just tried that because all the sudden I tought checking null != null might not be such a good idea.<br>I now get the right combinations.<br><br>Can you please tell me if this is a correct change?<br><br>Once again one of my earlier questions arises: why is a rule tested upon an entity before the planning variables are set?<br>Or am I wrong here?<br><br>Thanks,<br><br>Michiel<br></span></span></span></span><div><span><br></span></div><div>&nbsp;</div><div>-----------------<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/#!/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 &lt;<a rel="nofollow" ymailto="mailto:ge0ffrey.spam@gmail.com" target="_blank" href="mailto:ge0ffrey.spam@gmail.com">ge0ffrey.spam@gmail.com</a>&gt;<br> <b><span style="font-weight:bold;">To:</span></b> Rules Users List &lt;<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>&gt; <br> <b><span style="font-weight:bold;">Sent:</span></b> Monday, September 3, 2012 2:15 PM<br> <b><span style="font-weight:bold;">Subject:</span></b> Re: [rules-users] Best model for planning? technicians, airplanes and shifts =&gt; insertLogical problems<br> </font> </div> <br>
<div id="yiv1927383168">
  

    
  
  <div>
    <br>
    <div class="yiv1927383168moz-cite-prefix">Op 03-09-12 13:59, 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;">Hi,<br>
        <br>
        I'm not keen on spending time on a temp solution if I cannot
        estimate - at this time - how much time it will take me to build
        it correctly afterwards.<br>
        Budgets are limited... (as with anyone I guess :-)<br>
        Once again, it gives me a bad feeling that such a simple setup
        is giving me such a hard to solve issue.<br>
      </div>
    </blockquote>
    Incremental score calculation isn't a simple concept nor easy to
    implement.<br>
    But I agree that Drools and Planner should shield you from that
    complexity and take the heat there.<br>
    Planner already has extensive support to detect score corruption in
    incremental score calculation,<br>
    and Drools's compensation action looks promising to take greatly
    simply the complexity to the user.<br>
    <br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">I had thought that -
        given the project is only a very few classes - it would be
        peanuts for you or any other expert to pinpoint what I'm doing
        wrong.<br>
      </div>
    </blockquote>
    I didn't have the time to read all the classes in detail, just
    glimpsed over them.<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;"><br>
        Non the less... <br>
        <br>
        I tried to have a look again to a number of examples and I
        changed my rules, with a positive result!<br>
        I seem to get the correct solution. But... I do not know if my
        changes are valid.<br>
        I mean, is it possible that I threw a number of possible
        solutions away?<br>
        Maybe this will not show right now but will have it's effect
        when numbers grow and possible solutions shrink.<br>
        <br>
        So what I did is going from<br>
        <br>
        rule "tasksInSameJobMustBeInSamePeriod"<br>
        &nbsp;&nbsp;&nbsp; when<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $taskA : MaintenanceTask($id : id, $jobId : jobId,
        $periodId : periodId )<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MaintenanceTask(<span style="font-weight:bold;">id !=
          $id</span>, jobId == $jobId, <span style="font-weight:bold;">periodId
          != $periodId</span> )&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp; &lt;============&nbsp;&nbsp; a != $a<br>
        &nbsp;&nbsp;&nbsp; then<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("r3: " + $taskA );<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; insertLogical(new
        IntConstraintOccurrence("tasksInSameJobMustBeInSamePeriod",&nbsp;
        $taskA));<br>
        end <br>
        <div><br>
          <span></span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>to</span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><br>
          <span></span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>rule
            "tasksInSameJobMustBeInSamePeriod"<br>
            &nbsp;&nbsp;&nbsp; when<br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $taskA : MaintenanceTask($id : id, $jobId : jobId,
            $periodId : periodId )<br>
          </span></div>
      </div>
    </blockquote>
    $taskB:<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            MaintenanceTask(<span style="font-weight:bold;">id &gt; $id</span>,<br>
          </span></div>
      </div>
    </blockquote>
    Good, because if you count the combination task5-task7, you don't
    want to count the combination task7-task5 too.<span></span><br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>jobId == $jobId, <span style="font-weight:bold;">periodId &gt; $periodId</span>
            )&nbsp;&nbsp;&nbsp; //&nbsp; &lt;================ a &gt; $a<br>
          </span></div>
      </div>
    </blockquote>
    Bad, keep this on periodId != $periodId (or even period != $period)<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>&nbsp;&nbsp;&nbsp; then<br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("r3: " + $taskA );<br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; insertLogical(new
            IntConstraintOccurrence("tasksInSameJobMustBeInSamePeriod",&nbsp;
            $taskA));<br>
          </span></div>
      </div>
    </blockquote>
    Add $taskB too:<br>
    <span>insertLogical(new
      IntConstraintOccurrence("tasksInSameJobMustBeInSamePeriod",&nbsp;
      $taskA, $taskB));</span><br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>end&nbsp;</span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><br>
          <span></span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>Can you please tell me
            if this is THE solution or a dangerous move that works out
            now but will give issues when numbers grow?</span><br>
        </div>
      </div>
    </blockquote>
    The id &gt; $id change is good, the periodId != $periodId isn't.<br>
    <br>
    The above fixes could explain score corruption. You no longer get
    any exceptions in environmentMode DEBUG or TRACE?<br>
    <br>
    Keep looking at the examples: they work and they scale.<br>
    Keep providing feedback as to the pain points too of course.<br>
    <br>
    Hope that helps.<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><br>
          <span></span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>Thanks a lot.</span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><br>
          <span></span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>Michiel<br>
          </span></div>
        <div>&nbsp;</div>
        <div>-----------------<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/#!/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 rel="nofollow" class="yiv1927383168moz-txt-link-rfc2396E" ymailto="mailto:ge0ffrey.spam@gmail.com" target="_blank" href="mailto:ge0ffrey.spam@gmail.com">&lt;ge0ffrey.spam@gmail.com&gt;</a><br>
                <b><span style="font-weight:bold;">To:</span></b>
                Michiel Vermandel <a rel="nofollow" class="yiv1927383168moz-txt-link-rfc2396E" ymailto="mailto:mvermand@yahoo.com" target="_blank" href="mailto:mvermand@yahoo.com">&lt;mvermand@yahoo.com&gt;</a>; Rules
                Users List <a rel="nofollow" class="yiv1927383168moz-txt-link-rfc2396E" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" 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>
                Monday, September 3, 2012 11:56 AM<br>
                <b><span style="font-weight:bold;">Subject:</span></b>
                Re: Best model for planning? technicians, airplanes and
                shifts =&gt; insertLogical problems<br>
              </font> </div>
            <br>
            <div id="yiv1927383168">
              <div> <br>
                <div class="yiv1927383168moz-cite-prefix">Op 03-09-12
                  11:30, 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;">
                    <div><span>I did not really start on one example. I
                        have scrolled through several to try to figure
                        out how to do it, then started from scratch for
                        the POJO's and Rules. <br>
                      </span></div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>The
                        config file was copies from one of the examples
                        because it contained too many things that were
                        hard to get right in the beginning.</span></div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>I
                        know that is a risk but I needed to start
                        somewhere.</span></div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><br>
                    </div>
                  </div>
                </blockquote>
                I am thinking how to standardize the getting started
                with planner experience.<br>
                The cloud balance quick start is the example I pushing
                at the moment.<br>
                But for specific use case, it's better to start from an
                example that's similar to the user's use case.<br>
                The trouble is, it's often hard to see which example is
                similar and which is not.<br>
                <blockquote type="cite">
                  <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span></span></div>
                    <br>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>3)
                        What does "The workingMemory has 2
                        ConstraintOccurrence(s) in excess:" really mean?</span></div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;">&nbsp;&nbsp;&nbsp;
                      - Are the constraints there more than once?</div>
                  </div>
                </blockquote>
                No, it means that in a clean WorkingMemory, those 2
                ConstraintOccurrences aren't there,<br>
                but in the incremental WorkingMemory, they are there.<br>
                So they are in excess: they should have been
                automatically retracted by the rule engine, but for some
                reason, they are not.<br>
                <br>
                Read this section about incremental score calculation to
                understand why this complexity is needed:<br>
                &nbsp;
<a rel="nofollow" class="yiv1927383168moz-txt-link-freetext" target="_blank" href="http://docs.jboss.org/drools/release/5.4.0.Final/drools-planner-docs/html_single/index.html#incrementalScoreCalculation">http://docs.jboss.org/drools/release/5.4.0.Final/drools-planner-docs/html_single/index.html#incrementalScoreCalculation</a><br>
                <br>
                If you just want to prove that a Planner POC works for
                now (especially if you're close to giving up),<br>
                just take a few minutes to switch to a simple Java score
                calculator for now:<br>
                &nbsp;&nbsp;
<a rel="nofollow" class="yiv1927383168moz-txt-link-freetext" target="_blank" href="http://docs.jboss.org/drools/release/5.4.0.Final/drools-planner-docs/html_single/index.html#d0e3336">http://docs.jboss.org/drools/release/5.4.0.Final/drools-planner-docs/html_single/index.html#d0e3336</a><br>
                It will be _much_ slower especially when it scales out
                (but it should still be faster than anything you can
                invent yourself within reasonable time).<br>
                Once that works fine and you get a good result on your
                toy problem and you can scale out to 100+ jobs,<br>
                then switch back to drools to scale out to 10000+ jobs
                and follow the rest of this mail.<br>
                <br>
                <blockquote type="cite">
                  <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;">&nbsp;&nbsp;&nbsp;
                      - has this something to do with the equals and
                      hashcode (which I did implement (see below))?</div>
                  </div>
                </blockquote>
                Likely. The equals/hashcode methods are used of all
                objects in the causes parameter.<br>
                It's a design issue in Planner that the planner entity's
                equals/hashcode() needs to be used for the
                ConstraintOccurrence's causes.<br>
                Compensation action<br>
                <blockquote type="cite">
                  <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span><br>
                      </span></div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span class="yiv1927383168tab">&nbsp;&nbsp;&nbsp; </span><span>About
                        the compensation action: is it already available
                        on 5.4.0 final? Should I try that?</span></div>
                  </div>
                </blockquote>
                The plumbing is there in Drools Expert, but in Planner
                there are no decent examples, supporting code or even
                complex experiments yet.<br>
                It's a minefield, probably best to stay out until I get
                it done or you have more Planner experience :/<br>
                <blockquote type="cite">
                  <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span><br>
                      </span></div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>4)
                        I have been looking to the equals and hashcode,
                        though found many examples that implement
                        solutionEquals and solutionHashcode instead.</span></div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>&nbsp;&nbsp;&nbsp;
                        Currently I implemented them like this:</span></div>
                    <br>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>&nbsp;&nbsp;&nbsp;
                        @Override<br>
                        &nbsp;&nbsp;&nbsp; public int hashCode() {<br>
                        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return id.hashCode(); //(*)<br>
                        &nbsp;&nbsp;&nbsp; }<br>
                        <br>
                        &nbsp;&nbsp;&nbsp; @Override<br>
                        &nbsp;&nbsp;&nbsp; public boolean equals(Object o) {<br>
                        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (this == o) {<br>
                        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;<br>
                        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
                        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (id == null || !(o instanceof
                        MaintenanceTask)) {<br>
                        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return false;<br>
                        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else {<br>
                        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MaintenanceTask other =
                        (MaintenanceTask) o;<br>
                        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return id.equals(<a rel="nofollow" target="_blank" href="http://other.id/">other.id</a>);<br>
                        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
                        &nbsp;&nbsp;&nbsp; }</span></div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><br>
                    </div>
                  </div>
                </blockquote>
                Looks good<br>
                <blockquote type="cite">
                  <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span></span></div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><br>
                    </div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>&nbsp;
                        &nbsp; (*) id is a String property which is passed
                        into the entity object through the constructor
                        and upon cloning it is passed from the clone
                        source to the clone target:</span></div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;">&nbsp;&nbsp;&nbsp;<span class="yiv1927383168tab">&nbsp;&nbsp;&nbsp;&nbsp;</span> public
                      MaintenanceTask clone() {<br>
                      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span class="yiv1927383168tab">&nbsp;&nbsp;&nbsp; </span>System.out.println("Cloning

                      task " + id);<br>
                      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span class="yiv1927383168tab">&nbsp;&nbsp;&nbsp; </span>MaintenanceTask
                      clone = new MaintenanceTask(job, id);<br>
                      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span class="yiv1927383168tab">&nbsp;&nbsp;&nbsp; </span>clone.period
                      = this.period;<br>
                      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span class="yiv1927383168tab">&nbsp;&nbsp;&nbsp; </span>clone.technician
                      = this.technician;<br>
                      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span class="yiv1927383168tab">&nbsp;&nbsp;&nbsp; </span>return
                      clone;<br>
                      &nbsp;&nbsp;&nbsp; <span class="yiv1927383168tab">&nbsp;&nbsp;&nbsp; </span>}<br>
                      <span></span></div>
                  </div>
                </blockquote>
                Looks good.<br>
                <blockquote type="cite">
                  <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>&nbsp;&nbsp;&nbsp;
                        <br>
                      </span></div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span><br>
                      </span></div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>&nbsp;
                        &nbsp; I am still confused about:<br>
                      </span></div>
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>&nbsp;&nbsp;&nbsp;
                        - Which ones do I need to implement (equals or
                        solutionEquals, ...)?</span></div>
                  </div>
                </blockquote>
                because of this code:<br>
                &nbsp;
                <a rel="nofollow" class="yiv1927383168moz-txt-link-freetext" target="_blank" href="https://github.com/droolsjbpm/drools-planner/blob/master/drools-planner-core/src/main/java/org/drools/planner/core/score/constraint/ConstraintOccurrence.java#L54">https://github.com/droolsjbpm/drools-planner/blob/master/drools-planner-core/src/main/java/org/drools/planner/core/score/constraint/ConstraintOccurrence.java#L54</a><br>
                which is called by drools on insertLogical inserted
                objects (see drools expert manual on insertLogical)<br>
                <blockquote type="cite">
                  <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>&nbsp;&nbsp;&nbsp;
                        - Should an entity and a cloned entity have the
                        same result for both equals and hashcode? (I
                        guess so)</span></div>
                  </div>
                </blockquote>
                Yes, definitely.<br>
                <blockquote type="cite">
                  <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>&nbsp;&nbsp;&nbsp;
                        - Should only the entity objects have such
                        implementations? (Planning variables are never
                        cloned, right?)<br>
                      </span></div>
                  </div>
                </blockquote>
                It looks good. Only the entity's are cloned indeed
                during cloneSolution(): they are the only instances that
                change during planning.<br>
                <blockquote type="cite">
                  <div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
                    <div style="color:rgb(0, 0,
                      0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>&nbsp;&nbsp;
                      </span><br>
                    </div>
                    <div>&nbsp;</div>
                    <div>-----------------<br>
                      <a rel="nofollow" class="yiv1927383168moz-txt-link-freetext" target="_blank" href="http://www.codessentials.com/">http://www.codessentials.com</a>
                      - Your essential software, for free!<br>
                      Follow us at <a rel="nofollow" class="yiv1927383168moz-txt-link-freetext" target="_blank" href="http://twitter.com/#%21/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 rel="nofollow" class="yiv1927383168moz-txt-link-rfc2396E" ymailto="mailto:ge0ffrey.spam@gmail.com" target="_blank" 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 rel="nofollow" class="yiv1927383168moz-txt-link-rfc2396E" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" 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>
                            Monday, September 3, 2012 10:44 AM<br>
                            <b><span style="font-weight:bold;">Subject:</span></b>
                            Re: [rules-users] Best model for planning?
                            technicians, airplanes and shifts =&gt;
                            insertLogical problems<br>
                          </font> </div>
                        <br>
                        Op 03-09-12 10:21, Michiel Vermandel schreef:<br>
                        &gt; Hi Geoffrey,<br>
                        &gt;<br>
                        &gt; Thanks for the support so far.<br>
                        &gt; I understand that you do not provide full
                        support on this level.<br>
                        &gt; Though I have the feeling that this is
                        really<br>
                        &gt; - a very basic solution setup<br>
                        &gt; - a beginners-mistake and since I'm looking
                        into it now for about 3 days<br>
                        &gt; (since I started with planner) it seems to
                        be not obvious to find for a<br>
                        &gt; beginner.<br>
                        &gt; So I was trying my luck in offering the
                        code.<br>
                        &gt; It could be an opportunity to enrich the
                        documentation ;-) ;-)<br>
                        <br>
                        Good point, the score corruption problem is
                        often a beginner problem and <br>
                        it's a PITA. I 'll write some more docs about.<br>
                        <br>
                        Do note that your 3 day implementation should be
                        able to scale out to <br>
                        10000 planes pretty easily, so hang in there :)<br>
                        I fear you might have started copying from the
                        wrong example nqueens (if <br>
                        you did that) :/ Nurse rostering is a far more
                        similar to this kind of <br>
                        problem. I am not sure which example to promote
                        in the docs: the nqueens <br>
                        is simple enough to explain things on, but it's
                        too simple to copy from <br>
                        for real world stuff :/ Feedback welcome.<br>
                        <br>
                        &gt;<br>
                        &gt;<br>
                        &gt; Ok,<br>
                        &gt;<br>
                        &gt; 1) adding the $t2 results in the same sort
                        of exception, only<br>
                        &gt; planningEntity seems different:<br>
                        &gt;<br>
                        &gt; with insertLogical(new<br>
                        &gt;
                        UnweightedConstraintOccurrence("tasksInSameJobMustBeInSamePeriod",
                        $t1,<br>
                        &gt; $t2));<br>
                        &gt;<br>
                        &gt; Exception in thread "main"
                        java.lang.IllegalStateException: Score<br>
                        &gt; corruption: the workingScore (-2) is not
                        the uncorruptedScore (0):<br>
                        &gt;&nbsp; &nbsp; The workingMemory has 2
                        ConstraintOccurrence(s) in excess:<br>
                        &gt;&nbsp; &nbsp; &nbsp;
                        tasksInSameJobMustBeInSamePeriod/NEGATIVE_HARD:[Maintenance
                        of<br>
                        &gt; Boeing 737 - PJ23.I#1 73111693, Maintenance
                        of Boeing 737 - PJ23.I#2<br>
                        &gt; 427578167]<br>
                        &gt;&nbsp; &nbsp; &nbsp;
                        tasksInSameJobMustBeInSamePeriod/NEGATIVE_HARD:[Maintenance
                        of<br>
                        &gt; Boeing 737 - PJ23.I#2 427578167,
                        Maintenance of Boeing 737 - PJ23.I#1<br>
                        &gt; 73111693]<br>
                        &gt;&nbsp; &nbsp; Check the score rules who created those
                        ConstraintOccurrences. Verify<br>
                        &gt; that each ConstraintOccurrence's causes and
                        weight is correct.<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
org.drools.planner.core.score.director.AbstractScoreDirector.assertWorkingScore(AbstractScoreDirector.java:101)<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.doMove(DefaultGreedyDecider.java:110)<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.decideNextStep(DefaultGreedyDecider.java:78)<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:63)<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:183)<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:151)<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
be.axi.planner.domain.MaintenancePlanning.main(MaintenancePlanning.java:27)<br>
                        &gt;<br>
                        &gt; with insertLogical(new<br>
                        &gt;
                        UnweightedConstraintOccurrence("tasksInSameJobMustBeInSamePeriod",
                        $t1));<br>
                        &gt;<br>
                        &gt; Exception in thread "main"
                        java.lang.IllegalStateException: Score<br>
                        &gt; corruption: the workingScore (-2) is not
                        the uncorruptedScore (0):<br>
                        &gt;&nbsp; &nbsp; The workingMemory has 2
                        ConstraintOccurrence(s) in excess:<br>
                        &gt;&nbsp; &nbsp; &nbsp;
                        tasksInSameJobMustBeInSamePeriod/NEGATIVE_HARD:[Maintenance
                        of<br>
                        &gt; Airbus A350 - XJ34.I#2 778813475]<br>
                        &gt;&nbsp; &nbsp; &nbsp;
                        tasksInSameJobMustBeInSamePeriod/NEGATIVE_HARD:[Maintenance
                        of<br>
                        &gt; Airbus A350 - XJ34.I#0 225744121]<br>
                        &gt;&nbsp; &nbsp; Check the score rules who created those
                        ConstraintOccurrences. Verify<br>
                        &gt; that each ConstraintOccurrence's causes and
                        weight is correct.<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
org.drools.planner.core.score.director.AbstractScoreDirector.assertWorkingScore(AbstractScoreDirector.java:101)<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.doMove(DefaultGreedyDecider.java:110)<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.decideNextStep(DefaultGreedyDecider.java:78)<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:63)<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:183)<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:151)<br>
                        &gt;&nbsp; &nbsp; &nbsp; at<br>
                        &gt;
be.axi.planner.domain.MaintenancePlanning.main(MaintenancePlanning.java:27)<br>
                        &gt;<br>
                        &gt;<br>
                        &gt; 2) You suggested to replace
                        UnweightedConstraintOccurrence with<br>
                        &gt; IntConstraintOccurrence. I will.<br>
                        &gt; UnweightedConstraintOccurrence is used in
                        the very basic Queens example<br>
                        &gt; though...<br>
                        <br>
                        Yep, my mistake.<br>
                        <br>
                        &gt;<br>
                        &gt; 3) Where is the best place to read about
                        what insertLogical and<br>
                        &gt; IntConstraintOccurrence really do?<br>
                        &gt; What is the purpose of the Cause -objects,
                        which should be passed?<br>
                        &gt; =&gt; where is the best place to find
                        explanation about this?<br>
                        &gt; (<a rel="nofollow" target="_blank" href="http://docs.jboss.org/drools/release/5.4.0.Final/drools-planner-docs/html_single/">http://docs.jboss.org/drools/release/5.4.0.Final/drools-planner-docs/html_single/</a><br>
                        &gt; doesn't really enlighten me on that part)<br>
                        <br>
                        Look for "insertLogical" in the Drools Expert
                        guide:<br>
                        <br>
                        <a rel="nofollow" target="_blank" href="http://docs.jboss.org/drools/release/5.4.0.Final/drools-expert-docs/html_single/index.html">http://docs.jboss.org/drools/release/5.4.0.Final/drools-expert-docs/html_single/index.html</a><br>
                        <br>
                        When rules do an insertLogical of an object A,
                        it's discarded if another <br>
                        object B in the WorkingMemory equals object A
                        (through equals() and <br>
                        through hashcode()). Because the
                        ConstraintOccurrences need to be unique <br>
                        so they aren't discarded, they ruleId,
                        constraintType and causes are <br>
                        used for equals()/hashcode().<br>
                        <br>
                        Future work: "compensation action"<br>
                        Recently, drools introduced something called
                        "compensation action",<br>
                        which can probably replace the use
                        insertLogical(ConstraintOccurrence) <br>
                        and make the causes parameter obsolete.<br>
                        It's also faster.<br>
                        My first experiments look very promising, but I
                        haven't got time yet to <br>
                        experiment with it on all examples and make it
                        easy for users to use.<br>
                        <br>
                        It would allow us to do something like this in
                        the then part of a rule:<br>
                        &nbsp; hardAndSoftScoreHelper.addHardScore(-5);<br>
                        or<br>
                        &nbsp; hardAndSoftScoreHelper.addSoftScore(- $sum);<br>
                        or<br>
                        &nbsp; simpleScoreHelper.addScore(-7);<br>
                        <br>
                        No need for causes, insertLogicals, no
                        equals/hashcode() worries, much <br>
                        more flexible, ...<br>
                        <br>
                        <br>
                        4) Does your MaintenanceTask implement
                        equals()/hashcode() other than <br>
                        Object's original implementation?<br>
                        <br>
                        <br>
                        &gt;<br>
                        &gt; Thanks in advance.<br>
                        &gt;<br>
                        <br>
                        yw<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="yiv1927383168mimeAttachmentHeader"></fieldset>
                  <br>
                  <pre>_______________________________________________
rules-users mailing list
<a rel="nofollow" class="yiv1927383168moz-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="yiv1927383168moz-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>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="yiv1927383168mimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
rules-users mailing list
<a rel="nofollow" class="yiv1927383168moz-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="yiv1927383168moz-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 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></div>_______________________________________________<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>https://lists.jboss.org/mailman/listinfo/rules-users<br></blockquote></div><br></div></div><br><br> </div> </div>  </div></body></html>