I am facing issues in understanding the Drools rules which are implemented in one of the OptaPlanner demo example (NurseRostering application). Can anyone explain how the below rule works :
// a nurse can only work one shift per day, i.e. no two shift can be assigned to the same nurse on a day.
rule "oneShiftPerDay"
when
$leftAssignment : ShiftAssignment($leftId : id, $employee : employee, $shiftDate : shiftDate)
$rightAssignment : ShiftAssignment(employee == $employee, shiftDate == $shiftDate, id > $leftId)
then
insertLogical(new IntConstraintOccurrence("oneShiftPerDay", ConstraintType.NEGATIVE_HARD,
1,
$leftAssignment, $rightAssignment));
end
Are there any resources which states in detail about the explanation of the rules and the way they are implemented? When I check some of the examples online and in some books, i find it pretty easy to understand, however when i check the samples provided in Drools, i am unable to get an idea.