[rules-users] Drools Planner: contraint for rest time between shift

Geoffrey De Smet ge0ffrey.spam at gmail.com
Mon Feb 11 09:10:56 EST 2013


Op 11-02-13 13:12, fdauffy schreef:
> Hello,
> I'm starting a project regarding shift planning and while trying Drools
> Planner, I notice that in your documentation that somes contraints are given
> as example like rest time between shift.
> But in all the examples, I couldn't find any constraint like that.
> Does anybody already work on such constraint?
>
> Many thanks
>
> Frédéric
Shouldn't be hard, something like this:

rule "todo"
     when
         $left : ShiftAssignment(
             $employee : employee, employee != null,
             $leftShiftEnd : shiftEnd
         )
         $right : ShiftAssignment(
             employee == $employee,
             shiftStart >  $leftShiftEnd,
             shiftStart <  $leftShiftEnd + employee.minimumRestTime,
             $rightShiftStart : shiftStart
         )
         not ShiftAssignment(
             employee == $employee,
             shiftStart >  $leftShiftEnd,
             shiftStart <  $rightShiftStart
         )
     then
         insertLogical(..., $leftShiftEnd + employee.minimumRestTime - 
$rightShiftStart, $left, $right));
end

>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-contraint-for-rest-time-between-shift-tp4022200.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users



More information about the rules-users mailing list