<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <br>
    <div class="moz-cite-prefix">Op 04-02-13 14:24, Andr&eacute; Fr&oacute;es schreef:<br>
    </div>
    <blockquote
cite="mid:CAC8f_wUy+Cdhp_xqNQMi8wHALwTtxcKbh+R5WzgPrL8+Wiervg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hello there. I've been trying to create a rule to
        plan the my workorders with higher priority first, but I'm not
        bein able to.</div>
    </blockquote>
    First read up on the difference between "score weight" and "score
    levels":<br>
    &nbsp;
<a class="moz-txt-link-freetext" href="http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e3333">http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e3333</a><br>
    Does your business want to plan higher priority workitems always (=
    score level) or are there exceptions (= score weight)?<br>
    Ask them this: if you can assign 1000000 low priority tasks or only
    1 high priority task, what would you rather do?<br>
    <blockquote
cite="mid:CAC8f_wUy+Cdhp_xqNQMi8wHALwTtxcKbh+R5WzgPrL8+Wiervg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div><br>
        </div>
        <div style="">I tried creating a rule something like
          "conflictingLecturesInSamePeriod", but I'm getting lost.</div>
        <div style=""><br>
        </div>
        <div style="">Example: I've implemented my previous example of
          engineer/workorders and added shitf and priority. The
          priorities goes from 1 to 5, the lowest it is, the more urgent
          it is (1-Highest, 2-High, etc..)</div>
        <div style=""><br>
        </div>
        <div style="">I don't know how to compare it to the other in the
          list, so I tried checking with previous ID, but no success:</div>
        <div style="">******************************</div>
        <div style="">
          <div>rule "workOrderByPriority"</div>
          <div><span class="" style="white-space:pre"> </span>when</div>
          <div><span class="" style="white-space:pre"> </span>$leftWorkOrderPriority
            : WorkOrder($leftWOP : id, $leftPriority :
            priority.priorityID)</div>
          <div><span class="" style="white-space:pre"> </span>$righttWorkOrderPriority
            : WorkOrder(id &gt;= $leftWOP, $rightPriority :
            priority.priorityID)</div>
          <div><span class="" style="white-space:pre"> </span></div>
          <div><span class="" style="white-space:pre"> </span>$engineer:
            Engineer($id : id)<span class="" style="white-space:pre"> </span></div>
          <div><span class="" style="white-space:pre"> </span>then</div>
          <div><span class="" style="white-space:pre"> </span>insertLogical(new
            IntConstraintOccurrence("workOrderByPriority",
            ConstraintType.NEGATIVE_SOFT,&nbsp;</div>
          <div><span class="" style="white-space:pre"> </span>1,</div>
          <div><span class="" style="white-space:pre"> &lt;UNKNOWN&gt;</span>,
            $engineer));</div>
        </div>
      </div>
    </blockquote>
    makes no sense to me, especially since 1) there are no restrictions
    on engineer and 2) because it's the cause<br>
    <blockquote
cite="mid:CAC8f_wUy+Cdhp_xqNQMi8wHALwTtxcKbh+R5WzgPrL8+Wiervg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div style="">
          <div>end</div>
          <div>*******************************</div>
          <div>this above is the second attempt, the &lt;UNKNOWN&gt; is
            because i'm lost about what to add and also if i should add
            something there.<br>
          </div>
          <div><br>
          </div>
          <div style="">the first try just pass straight forward</div>
          <div style="">*******************************<br>
          </div>
          <div style="">
            <div>rule "workOrderByPriority"</div>
            <div><span class="" style="white-space:pre"> </span>when</div>
            <div><span class="" style="white-space:pre"> </span>$engineer
              : Engineer($worktime : worktime)</div>
            <div><span class="" style="white-space:pre"> </span>$priority
              : WorkOrder($priorityId : priority.priorityID)</div>
            <div>
              <span class="" style="white-space:pre"> </span>then</div>
            <div><span class="" style="white-space:pre"> </span>insertLogical(new
              IntConstraintOccurrence("workOrderByPriority",
              ConstraintType.NEGATIVE_SOFT,&nbsp;</div>
            <div><span class="" style="white-space:pre"> </span>2,</div>
            <div><span class="" style="white-space:pre"> </span>$priority,
              $engineer));</div>
            <div>end</div>
          </div>
          <div style="">*******************************<br>
          </div>
          <div style="">
            i know i'm far from get even closer. In order to define the
            planner according to priority I think I should compare it
            with entire list isn't? I noticed that in some rules, and
            entire list is pointed. <br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    "Plan according to priority" is vague, here's are some suggestions
    on implementation:<br>
    <br>
    A)<br>
    When<br>
    &nbsp; there's unassigned workorder<br>
    &nbsp; and there's an engineer capable of doing that workorder<br>
    &nbsp; and the engineer has a workorder with a lower priority (use
    "exists" here)<br>
    then<br>
    &nbsp; the engineer should be doing the other workorder<br>
    &nbsp; -1 (with the cause being the unassigned workorder)<br>
    <br>
    B)<br>
    When<br>
    &nbsp;&nbsp; there's an unassigned workorder<br>
    then<br>
    &nbsp; -1 * priority * 1000 (with the cause being the unassigned
    workorder)<br>
    <br>
    HTH<br>
    <blockquote
cite="mid:CAC8f_wUy+Cdhp_xqNQMi8wHALwTtxcKbh+R5WzgPrL8+Wiervg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div style="">
          <div style="">
            <br>
          </div>
          <div style="">I searched the guide and example for some tips,
            but the best I found was the course that compared 2 courses
            that I believe that will be the same thing i'll have to do
            with priorities.</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>