Op 04-02-13 14:24, André Fróes schreef:
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.
First read up on the difference between "score weight" and "score levels":
  http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e3333
Does your business want to plan higher priority workitems always (= score level) or are there exceptions (= score weight)?
Ask them this: if you can assign 1000000 low priority tasks or only 1 high priority task, what would you rather do?

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));
makes no sense to me, especially since 1) there are no restrictions on engineer and 2) because it's the cause
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.

"Plan according to priority" is vague, here's are some suggestions on implementation:

A)
When
  there's unassigned workorder
  and there's an engineer capable of doing that workorder
  and the engineer has a workorder with a lower priority (use "exists" here)
then
  the engineer should be doing the other workorder
  -1 (with the cause being the unassigned workorder)

B)
When
   there's an unassigned workorder
then
  -1 * priority * 1000 (with the cause being the unassigned workorder)

HTH

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.


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users