<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    There's a bit too many issues being taken on at the same time for me
    to grasp the problem,<br>
    but my first advice would be:<br>
    <br>
    Apply "separation of concerns" on the constraints. Tackle each
    problem individually.<br>
    These 3 constraints are defined/implemented individually, isolated
    basically:<br>
    <br>
    1) Required skill: A Workorder's engineer need to have the skill to
    fulfill the workorder.<br>
    <br>
    2) Workload: An engineer's total WorkOrders count needs to be below
    a threshold. <br>
    &nbsp; Important: punish by the (threshold - totalCount), not just -1 if
    above it. See this image:<br>
    &nbsp;
<a class="moz-txt-link-freetext" href="https://hudson.jboss.org/hudson/view/Drools%20jBPM/job/drools-planner/lastSuccessfulBuild/artifact/drools-planner-docs/target/docbook/publish/en-US/html_single/index.html#scoreTrap">https://hudson.jboss.org/hudson/view/Drools%20jBPM/job/drools-planner/lastSuccessfulBuild/artifact/drools-planner-docs/target/docbook/publish/en-US/html_single/index.html#scoreTrap</a><br>
    <br>
    3) Priority: This one is a bit more difficult.<br>
    Basically, you're stating that some tasks have priorities over
    others.<br>
    There are different ways you can implement this, depending on how
    you define priority.<br>
    <br>
    3a) One way is to ignore all the other constraints and just state
    that every unassigned tasks infers a penalty based on it's priority.<br>
    This implies that the optimal solution will still break a lot of
    these constraints: it will just break the least of them.<br>
    This might also not be perfect because the lower priority workorders
    might add up to beat a higher priority workorder (which may or may
    not be the behavior you want):<br>
<a class="moz-txt-link-freetext" 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-Score_calculation/scoreFoldingIsBroken.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-Score_calculation/scoreFoldingIsBroken.png</a><br>
    <br>
    3b) Another way is to keep the other constraints in mind:<br>
    When there is an unassigned WorkOrder, they should not be second
    WorkOrder, which is different, is assigned, has a higher priority
    AND that can be done by the same Engineer (=&gt; check skill for the
    second WorkOrder).<br>
    Notice that we don't re-implement "1) Required skill" here for the
    unassigned WorkOrder, but we do check the skill for the second
    WorkOrder.<br>
    <br>
    3c) Do a) and b) with a separate score level per priority. Without
    6.0's BendableScore, it means you would have to write your own
    ScoreDefinition. Probably overkill (just ignore this for now).<br>
    <br>
    I 'd recommend 3b) over 3a) and 3c)<br>
    <br>
    <div class="moz-cite-prefix">Op 20-02-13 13:50, Andr&eacute; Fr&oacute;es schreef:<br>
    </div>
    <blockquote
cite="mid:CAC8f_wVjjVYd642xPA366HLm1YO=MAGgOHmJoqOkyL8NtYfK_Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">Thanks for the answer Armand, I'll try to explain
        better the model, since there's more people asking me about it
        here by e-mail (Ana Kuzjminska and others).
        <div><br>
        </div>
        <div>Before that, I tried what you passed me, I had already
          tried that aproach, but didn't work, it sorts, but doesn't
          give the engineer the proper workorder.</div>
        <div><br>
        </div>
        <div>About the model I am trying to create, it is a simple
          distribution of workorder to engineers (for any kind of
          company), where workorder is considered to be any kind of
          problem, and it has a priority to be respected and, sometimes,
          one or more skills, that are required to do that work, for
          example, an engineer that must fix an antena must know how to
          fix that, otherwise, there's no reason to send him there.</div>
        <div><br>
        </div>
        <div>An engineer may have none or several skills. Everyone has a
          worktime to be respected (this is working at the model, but
          I'm not using Date attribute yet, it will be another step).</div>
        <div><br>
        </div>
        <div>The model classes:</div>
        <div><br>
        </div>
        <div>Engineer</div>
        <div>-- worktime (int)</div>
        <div>-- name (string)</div>
        <div>-- skillEngineerList (List&lt;SkillEngineerList&gt;)</div>
        <div><br>
        </div>
        <div>Workorder (PlanningEntity)</div>
        <div>-- requiredWorktime (int)</div>
        <div>-- priority (Priority)</div>
        <div>-- requiredSkills (List&lt;SkillWorkOrder&gt;)</div>
        <div>-- engineer (engineer)</div>
        <div><br>
        </div>
        <div>SkillEngineerList<br>
        </div>
        <div>-- engineer (engineer)</div>
        <div>-- skill (skill)</div>
        <div><br>
        </div>
        <div>SkillWorkOrder<br>
        </div>
        <div>-- workorder (workorder)</div>
        <div>-- skill (skill)</div>
        <div><br>
        </div>
        <div>Skill</div>
        <div>-- name (string)</div>
        <div><br>
        </div>
        <div>Priority (enum)</div>
        <div>-- code (string)</div>
        <div>-- deadline (double)</div>
        <div><br>
        </div>
        <div>
          As you can see, a workorder may have none to several skills,
          same's for engineer, there's where I am at the moment. By
          scorecalculator i was able to make it work, but it is not
          excluding the workorders that exceed engineers time:</div>
        <div><br>
        </div>
        <div>Engineer 1, worktime 8 - skill ABC1, ABC2</div>
        <div><br>
        </div>
        <div>WorkOrder 1, worktime 8 - requiredSkills ABC2</div>
        <div>WorkOrder 2, worktime 8 - requiredSkills ABC1</div>
        <div><br>
        </div>
        <div>only one should be assigned to it, since he can do both,
          but when running my model, the hard constraint of time is
          being broken, and both are assigned.</div>
        <div><br>
        </div>
        <div>
          After that works, the next step to this model would be
          implement the priority, the lower the deadline is, the more
          important it is, and it will work directly with a date
          property that i'll insert in worktime object later, because
          the workorder will have to be answered from the moment it is
          registered according to its priority.</div>
        <div><br>
        </div>
        <div style="">It would be something like this:</div>
        <div><br>
        </div>
        <div style="">
          <div>Workorder (PlanningEntity)</div>
          <div>-- requiredWorktime (int)</div>
          <div style="">-- created (Date) &lt;--</div>
          <div>-- priority (Priority)</div>
          <div>-- requiredSkills (List&lt;SkillWorkOrder&gt;)</div>
          <div>-- engineer (engineer)</div>
          <div><br>
          </div>
          <div style="">so, if a workorder is registered at 10:00 am and
            priority is P1 with deadline of 1 hour, it should be
            answered right away, based on engineer worktime either.</div>
          <div style=""><br>
          </div>
          <div style="">The solution I found by scorecalculator:</div>
          <div style="">
            <div><span class="" style="white-space:pre"> </span>public
              HardAndSoftScore calculateScore(Distributor distributor) {</div>
            <div><span class="" style="white-space:pre"> </span>int
              hardScore = 0;</div>
            <div><span class="" style="white-space:pre"> </span>int
              softScore = 0;</div>
            <div><span class="" style="white-space:pre"> </span></div>
            <div><span class="" style="white-space:pre"> </span>for
              (Engineer e : distributor.getEngineerList()){</div>
            <div><span class="" style="white-space:pre"> </span>int
              requiredWorktime = 0;</div>
            <div><span class="" style="white-space:pre"> </span>List&lt;Skill&gt;
              requiredSkillList = new ArrayList&lt;Skill&gt;();</div>
            <div><span class="" style="white-space:pre"> </span></div>
            <div><span class="" style="white-space:pre"> </span>for
              (WorkOrder o : distributor.getWorkOrderList()){</div>
            <div><span class="" style="white-space:pre"> </span>if
              (e.equals(o.getEngineer())){</div>
            <div><span class="" style="white-space:pre"> </span>requiredWorktime
              += o.getRequiredWorktime();</div>
            <div><span class="" style="white-space:pre"> </span>for
              (SkillWorkOrder swo : o.getRequiredSkills()){</div>
            <div><span class="" style="white-space:pre"> </span>requiredSkillList.add(swo.getSkill());</div>
            <div><span class="" style="white-space:pre"> </span>}</div>
            <div><span class="" style="white-space:pre"> </span>}</div>
            <div><span class="" style="white-space:pre"> </span>}</div>
            <div><span class="" style="white-space:pre"> </span></div>
            <div><span class="" style="white-space:pre"> </span>int
              engineerAvailableTime = e.getWorktime() -
              requiredWorktime;</div>
            <div><span class="" style="white-space:pre"> </span>if
              (engineerAvailableTime &lt; 0 ){</div>
            <div><span class="" style="white-space:pre"> </span>hardScore
              += engineerAvailableTime;</div>
            <div><span class="" style="white-space:pre"> </span>}</div>
            <div><span class="" style="white-space:pre"> </span></div>
            <div><span class="" style="white-space:pre"> </span>int
              commonSkillCount = 0;</div>
            <div><span class="" style="white-space:pre"> </span>for
              (SkillEngineer se : e.getSkillEngineerList()){</div>
            <div><span class="" style="white-space:pre"> </span>for
              (Skill s : requiredSkillList){</div>
            <div><span class="" style="white-space:pre"> </span>if
              (se.getSkill().getId() == s.getId()){</div>
            <div><span class="" style="white-space:pre"> </span>commonSkillCount++;</div>
            <div><span class="" style="white-space:pre"> </span>}</div>
            <div><span class="" style="white-space:pre"> </span>}</div>
            <div><span class="" style="white-space:pre"> </span>}</div>
            <div><span class="" style="white-space:pre"> </span></div>
            <div><span class="" style="white-space:pre"> </span>if
              (commonSkillCount != 0){</div>
            <div><span class="" style="white-space:pre"> </span>hardScore
              += commonSkillCount;</div>
            <div><span class="" style="white-space:pre"> </span>}</div>
            <div><span class="" style="white-space:pre"> </span></div>
            <div><span class="" style="white-space:pre"> </span>}</div>
            <div><span class="" style="white-space:pre"> </span></div>
            <div><span class="" style="white-space:pre"> </span>return
              DefaultHardAndSoftScore.valueOf(hardScore, softScore);</div>
            <div><span class="" style="white-space:pre"> </span>}</div>
            <div><br>
            </div>
            <div style="">but as I said, every workorder is being
              assigned exceeding engineer's worktime.</div>
          </div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">2013/2/19 Welsh, Armand <span
            dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:AWelsh@statestreet.com" target="_blank">AWelsh@statestreet.com</a>&gt;</span><br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div link="blue" vlink="purple" lang="EN-US">
              <div>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">I
                    would consider using comparable lists, where
                    workorderSkill.compareTo(employeeSkills) can be true
                    for the same skill.&nbsp;
                  </span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;</span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">When</span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    $workorder : WorkOrder( $requiredSkills : skills)</span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    $workorderSkill : Skill ( ) from $requiredSkills</span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    $employee : Employee( skills contains
                    $workorderSkill)</span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">then</span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    // do whatever, for each employee with a matching
                    skill for all work orders, this rule will file.</span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    // if you need to limit only one employee with
                    matching skill to workorder, then more logic will
                    need to be built
                  </span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;</span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">End</span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;</span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">In
                    this scenario, you are collecting all the workorder,
                    and required skills.&nbsp; Then you check each employee
                    to see if their list of skills contains any of the
                    required skills (not all skill are required in this
                    case, just one skill like your example suggested).</span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;</span></p>
                <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">
                    <a moz-do-not-send="true"
                      href="mailto:rules-users-bounces@lists.jboss.org"
                      target="_blank">rules-users-bounces@lists.jboss.org</a>
                    [mailto:<a moz-do-not-send="true"
                      href="mailto:rules-users-bounces@lists.jboss.org"
                      target="_blank">rules-users-bounces@lists.jboss.org</a>]
                    <b>On Behalf Of </b>Andr&eacute; Fr&oacute;es<br>
                    <b>Sent:</b> Monday, February 18, 2013 10:52 AM</span></p>
                <div class="im"><br>
                  <b>To:</b> Rules Users List<br>
                  <b>Subject:</b> Re: [rules-users] Comparing 2 Lists
                  [Planner]</div>
                <p class="MsoNormal">&nbsp;</p>
                <div>
                  <p class="MsoNormal">I found (i guess) a way to
                    iterate over list, but it is not comparing and
                    assigning the workorder now. I tried this way:</p>
                  <div>
                    <div class="h5">
                      <div>
                        <p class="MsoNormal">-----------------</p>
                      </div>
                      <div>
                        <p class="MsoNormal">rule "requiredSkill"</p>
                      </div>
                      <div>
                        <p class="MsoNormal">&nbsp; &nbsp;when</p>
                      </div>
                      <div>
                        <p class="MsoNormal">&nbsp; &nbsp; &nbsp; &nbsp;There is an
                          unassigned workorder</p>
                      </div>
                      <div>
                        <p class="MsoNormal">&nbsp; &nbsp; &nbsp; &nbsp;and the workorder
                          has a requiredSkill other than null</p>
                      </div>
                      <div>
                        <p class="MsoNormal">&nbsp;</p>
                      </div>
                      <div>
                        <p class="MsoNormal">&nbsp; &nbsp; &nbsp; &nbsp;and there is an
                          engineer</p>
                      </div>
                      <div>
                        <p class="MsoNormal">&nbsp; &nbsp; &nbsp; &nbsp;and the engineer has
                          a skill other than null</p>
                      </div>
                      <div>
                        <p class="MsoNormal">&nbsp;</p>
                      </div>
                      <div>
                        <p class="MsoNormal">&nbsp; &nbsp; &nbsp; &nbsp;and engineer skill
                          is the same as workorder skill</p>
                      </div>
                      <div>
                        <p class="MsoNormal">&nbsp; &nbsp;then</p>
                      </div>
                      <div>
                        <p class="MsoNormal">&nbsp; &nbsp; &nbsp; &nbsp;assign workorder to
                          engineer</p>
                      </div>
                      <div>
                        <p class="MsoNormal">engineer</p>
                      </div>
                      <div>
                        <p class="MsoNormal">-----------------</p>
                      </div>
                      <div>
                        <p class="MsoNormal">this is how i tried
                          implementing;</p>
                      </div>
                      <div>
                        <p class="MsoNormal">-----------------</p>
                      </div>
                      <div>
                        <div>
                          <p class="MsoNormal">rule "requiredSkill"</p>
                        </div>
                        <div>
                          <p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when</p>
                        </div>
                        <div>
                          <p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
                            $workOrder : WorkOrder()&nbsp;</p>
                        </div>
                        <div>
                          <p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
                            &nbsp;$woReqSkill :
                            SkillWorkOrder($requiredSkillWO : skill ,
                            eval(skill != null)) from
                            $workOrder.requiredSkills&nbsp;</p>
                        </div>
                        <div>
                          <p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;</p>
                        </div>
                        <div>
                          <p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;$engineer
                            : Engineer()</p>
                        </div>
                        <div>
                          <p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
                            &nbsp;$engineerSkill : SkillEngineer($engSkill :
                            skill, eval(skill != null)) from
                            $engineer.skillEngineerList</p>
                        </div>
                        <div>
                          <p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;</p>
                        </div>
                        <div>
                          <p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;exists
                            SkillEngineer( $engineerSkill.skill ==
                            $woReqSkill.skill )</p>
                        </div>
                        <div>
                          <p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then</p>
                        </div>
                        <div>
                          <p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            insertLogical(new
                            IntConstraintOccurrence("requiredSkill",
                            ConstraintType.NEGATIVE_HARD,</p>
                        </div>
                        <div>
                          <p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            1, $engineer));</p>
                        </div>
                        <div>
                          <p class="MsoNormal">end</p>
                        </div>
                      </div>
                      <div>
                        <p class="MsoNormal">-----------------</p>
                      </div>
                      <div>
                        <p class="MsoNormal">But all workorders are
                          going to the same one, it is not validating if
                          one is equals to other.</p>
                      </div>
                    </div>
                  </div>
                </div>
                <div>
                  <div class="h5">
                    <div>
                      <p class="MsoNormal" style="margin-bottom:12.0pt">&nbsp;</p>
                      <div>
                        <p class="MsoNormal">2013/2/18 Andr&eacute; Fr&oacute;es &lt;<a
                            moz-do-not-send="true"
                            href="mailto:arfmoraes@gmail.com"
                            target="_blank">arfmoraes@gmail.com</a>&gt;</p>
                        <div>
                          <p class="MsoNormal">Hello everyone!</p>
                          <div>
                            <p class="MsoNormal">&nbsp;</p>
                          </div>
                          <div>
                            <p class="MsoNormal">How can I compare 2
                              lists with a rule?</p>
                          </div>
                          <div>
                            <p class="MsoNormal">I upgraded my basic
                              model to a more complex one now, but now I
                              hit a wall. My WorkOrder have a List of
                              skills, and my Engineer also have a list
                              of Skills and I have to compare one with
                              another.</p>
                          </div>
                          <div>
                            <p class="MsoNormal">&nbsp;</p>
                          </div>
                          <div>
                            <p class="MsoNormal">Example:</p>
                          </div>
                          <div>
                            <p class="MsoNormal">&nbsp;</p>
                          </div>
                          <div>
                            <p class="MsoNormal">Engineer A have skill
                              ABC 1</p>
                          </div>
                          <div>
                            <p class="MsoNormal">Engineer B have skill
                              ABC 2</p>
                          </div>
                          <div>
                            <p class="MsoNormal">Engineer C have skill
                              ABC 3</p>
                          </div>
                          <div>
                            <p class="MsoNormal">&nbsp;</p>
                          </div>
                          <div>
                            <p class="MsoNormal">WorkOrder A needs an
                              engineer with skill ABC 3</p>
                          </div>
                          <div>
                            <p class="MsoNormal">WorkOrder B needs an
                              engineer with skill ABC 1</p>
                          </div>
                          <div>
                            <p class="MsoNormal">WorkOrder C needs an
                              engineer with skill ABC 2</p>
                          </div>
                          <div>
                            <p class="MsoNormal">&nbsp;</p>
                          </div>
                          <div>
                            <p class="MsoNormal">The result should be
                              this:</p>
                          </div>
                          <div>
                            <p class="MsoNormal">&nbsp;</p>
                          </div>
                          <div>
                            <p class="MsoNormal">Engineer A will receive
                              WorkOrder B</p>
                          </div>
                          <div>
                            <p class="MsoNormal">Engineer B will receive
                              WorkOrder C</p>
                          </div>
                          <div>
                            <p class="MsoNormal">Engineer C will receive
                              WorkOrder A</p>
                          </div>
                          <div>
                            <p class="MsoNormal">---------------</p>
                          </div>
                          <div>
                            <p class="MsoNormal">&nbsp;</p>
                          </div>
                          <div>
                            <p class="MsoNormal">I am able to sort it by
                              time, but not by skill, and I don't know
                              how to loop over each list to find if one
                              have the skills needed to fulful the
                              other. These are my classes involved:</p>
                          </div>
                          <div>
                            <p class="MsoNormal">&nbsp;</p>
                          </div>
                          <div>
                            <p class="MsoNormal">WorkOrder attributes:</p>
                          </div>
                          <div>
                            <p class="MsoNormal">--------</p>
                          </div>
                          <div>
                            <div>
                              <p class="MsoNormal">private int
                                requiredWorktime;</p>
                            </div>
                            <div>
                              <p class="MsoNormal">private Priority
                                priority;(enum)</p>
                            </div>
                            <div>
                              <p class="MsoNormal">private Severity
                                severity;(enum)</p>
                            </div>
                            <div>
                              <p class="MsoNormal">private
                                List&lt;SkillWorkOrder&gt;
                                requiredSkills;</p>
                            </div>
                            <div>
                              <p class="MsoNormal">--------</p>
                            </div>
                            <div>
                              <p class="MsoNormal">Engineer attributes:</p>
                            </div>
                            <div>
                              <p class="MsoNormal">--------</p>
                            </div>
                            <div>
                              <div>
                                <p class="MsoNormal">private int
                                  worktime;</p>
                              </div>
                              <div>
                                <p class="MsoNormal">private String
                                  name;</p>
                              </div>
                              <div>
                                <p class="MsoNormal">private
                                  List&lt;SkillEngineer&gt;
                                  skillEngineerList;</p>
                              </div>
                              <div>
                                <p class="MsoNormal">--------</p>
                              </div>
                              <div>
                                <p class="MsoNormal">Skill attributes:</p>
                              </div>
                              <div>
                                <p class="MsoNormal">--------</p>
                              </div>
                              <div>
                                <p class="MsoNormal">private String
                                  name;</p>
                              </div>
                              <div>
                                <p class="MsoNormal">--------</p>
                              </div>
                              <div>
                                <p class="MsoNormal">&nbsp;</p>
                              </div>
                              <div>
                                <p class="MsoNormal">both SkillEngineer
                                  and SkillWorkOrder are classes that
                                  simple receives the named class and a
                                  Skill:</p>
                              </div>
                              <div>
                                <p class="MsoNormal">Eg:</p>
                              </div>
                              <div>
                                <div>
                                  <p class="MsoNormal">private Engineer
                                    engineer; //Or WorkOrder</p>
                                </div>
                                <div>
                                  <p class="MsoNormal">private Skill
                                    skill;</p>
                                </div>
                                <div>
                                  <p class="MsoNormal">&nbsp;</p>
                                </div>
                                <div>
                                  <p class="MsoNormal">Is it possible to
                                    iterate over these 2 lists, by drool
                                    rule, to check wich engineer have
                                    most coincidences with an workorder?
                                    (Eg: if and Engineer have skill
                                    ABC1, ABC2 and a WorkOrder needs an
                                    engineer with skill ABC1, ABC2 and
                                    ABC3 he would be choseng among the
                                    others because his skills)</p>
                                </div>
                              </div>
                              <div>
                                <p class="MsoNormal">&nbsp;</p>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <p class="MsoNormal">&nbsp;</p>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            rules-users mailing list<br>
            <a moz-do-not-send="true"
              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>
          </blockquote>
        </div>
        <br>
      </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>