[rules-users] Rule to order by priority [Planner]

André Fróes arfmoraes at gmail.com
Mon Feb 4 08:24:22 EST 2013


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.

I tried creating a rule something like "conflictingLecturesInSamePeriod",
but I'm getting lost.

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..)

I don't know how to compare it to the other in the list, so I tried
checking with previous ID, but no success:
******************************
rule "workOrderByPriority"
when
$leftWorkOrderPriority : WorkOrder($leftWOP : id, $leftPriority :
priority.priorityID)
$righttWorkOrderPriority : WorkOrder(id >= $leftWOP, $rightPriority :
priority.priorityID)
 $engineer: Engineer($id : id)
then
insertLogical(new IntConstraintOccurrence("workOrderByPriority",
ConstraintType.NEGATIVE_SOFT,
1,
<UNKNOWN>, $engineer));
end
*******************************
this above is the second attempt, the <UNKNOWN> is because i'm lost about
what to add and also if i should add something there.

the first try just pass straight forward
*******************************
rule "workOrderByPriority"
when
$engineer : Engineer($worktime : worktime)
$priority : WorkOrder($priorityId : priority.priorityID)
then
insertLogical(new IntConstraintOccurrence("workOrderByPriority",
ConstraintType.NEGATIVE_SOFT,
2,
$priority, $engineer));
end
*******************************
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.

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130204/f31d8365/attachment.html 


More information about the rules-users mailing list