<div dir="ltr">Hello there. I&#39;ve been trying to create a rule to plan the my workorders with higher priority first, but I&#39;m not bein able to.<div><br></div><div style>I tried creating a rule something like &quot;conflictingLecturesInSamePeriod&quot;, but I&#39;m getting lost.</div>
<div style><br></div><div style>Example: I&#39;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&#39;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 &quot;workOrderByPriority&quot;</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(&quot;workOrderByPriority&quot;, ConstraintType.NEGATIVE_SOFT, </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>end</div><div>*******************************</div><div>this above is the second attempt, the &lt;UNKNOWN&gt; is because i&#39;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 &quot;workOrderByPriority&quot;</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(&quot;workOrderByPriority&quot;, ConstraintType.NEGATIVE_SOFT, </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&#39;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&#39;t? I noticed that in some rules, and entire list is pointed. <br></div><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&#39;ll have to do with priorities.</div></div></div>