[rules-users] Long pattern for Nurse Rostering

john poole jdpoole at gmail.com
Fri Aug 9 01:32:31 EDT 2013


I'm trying to create a rule for a 15 day pattern. When the patterns uses the
same shift for all 15 days, I do this:

rule "unWanted15DayPattern"
    when
        $pattern : U15DayPattern(
            $numberOfDays : numberOfDays,
            $shiftType : shiftType
        )

        ShiftAssignment(
            shiftType == $shiftType,
            $employee : employee, 
            $firstDayIndex : shiftDateDayIndex
        )
        
        ShiftDate( $firstDayIndex == dayIndex, dayIndex % 15 == 0)
        
//Check for different employee working that shift in the next N days        
       $shiftAssignment : ShiftAssignment(
            shiftType == $shiftType,
            employee != $employee,
            shiftDateDayIndex > $firstDayIndex,
            shiftDateDayIndex < $firstDayIndex + 15
        )
       
    then       
   
     insertLogical(new IntConstraintOccurrence("unWanted15DayPattern",
ConstraintType.NEGATIVE_SOFT,
               $pattern.getWeight(),
                $firstDayIndex));
end

But I'm having a hard time figuring out how to do it with different
shiftTypes for each day, because it means having to use a loop. 
Not sure if that makes sense, but it anyone has used a long pattern that
stores items in a list/array I'd love to hear how they did it.




--
View this message in context: http://drools.46999.n3.nabble.com/Long-pattern-for-Nurse-Rostering-tp4025432.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list