[jboss-svn-commits] JBL Code SVN: r33197 - labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/solver.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun May 30 08:21:36 EDT 2010
Author: ge0ffrey
Date: 2010-05-30 08:21:35 -0400 (Sun, 30 May 2010)
New Revision: 33197
Modified:
labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/solver/nurseRosteringScoreRules.drl
Log:
unwantedPatternShiftType3DaysPattern && unwantedPatternShiftType4DaysPattern
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/solver/nurseRosteringScoreRules.drl
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/solver/nurseRosteringScoreRules.drl 2010-05-30 12:14:07 UTC (rev 33196)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/solver/nurseRosteringScoreRules.drl 2010-05-30 12:21:35 UTC (rev 33197)
@@ -538,12 +538,12 @@
)
Assignment(
- eval(null == $dayIndex0ShiftType) || (shiftType == $dayIndex0ShiftType),
+ eval($dayIndex0ShiftType == null) || (shiftType == $dayIndex0ShiftType),
contract == $contract, shiftDateDayOfWeek == $startDayOfWeek,
$employee : employee, $firstDayIndex : shiftDateDayIndex
)
Assignment(
- eval(null == $dayIndex1ShiftType) || (shiftType == $dayIndex1ShiftType),
+ eval($dayIndex1ShiftType == null) || (shiftType == $dayIndex1ShiftType),
employee == $employee,
shiftDateDayIndex == ($firstDayIndex + 1)
)
@@ -552,7 +552,77 @@
$pattern.getWeight(),
$employee, $pattern, $firstDayIndex));
end
+rule "unwantedPatternShiftType3DaysPattern"
+ when
+ $pattern : ShiftType3DaysPattern(
+ $startDayOfWeek : startDayOfWeek,
+ $dayIndex0ShiftType : dayIndex0ShiftType,
+ $dayIndex1ShiftType : dayIndex1ShiftType,
+ $dayIndex2ShiftType : dayIndex2ShiftType
+ )
+ PatternContractLine(
+ pattern == $pattern, $contract : contract
+ )
+ Assignment(
+ eval($dayIndex0ShiftType == null) || (shiftType == $dayIndex0ShiftType),
+ contract == $contract, shiftDateDayOfWeek == $startDayOfWeek,
+ $employee : employee, $firstDayIndex : shiftDateDayIndex
+ )
+ Assignment(
+ eval($dayIndex1ShiftType == null) || (shiftType == $dayIndex1ShiftType),
+ employee == $employee,
+ shiftDateDayIndex == ($firstDayIndex + 1)
+ )
+ Assignment(
+ eval($dayIndex2ShiftType == null) || (shiftType == $dayIndex2ShiftType),
+ employee == $employee,
+ shiftDateDayIndex == ($firstDayIndex + 2)
+ )
+ then
+ insertLogical(new IntConstraintOccurrence("unwantedPattern", ConstraintType.NEGATIVE_SOFT,
+ $pattern.getWeight(),
+ $employee, $pattern, $firstDayIndex));
+end
+rule "unwantedPatternShiftType4DaysPattern"
+ when
+ $pattern : ShiftType4DaysPattern(
+ $startDayOfWeek : startDayOfWeek,
+ $dayIndex0ShiftType : dayIndex0ShiftType,
+ $dayIndex1ShiftType : dayIndex1ShiftType,
+ $dayIndex2ShiftType : dayIndex2ShiftType,
+ $dayIndex3ShiftType : dayIndex3ShiftType
+ )
+ PatternContractLine(
+ pattern == $pattern, $contract : contract
+ )
+
+ Assignment(
+ eval($dayIndex0ShiftType == null) || (shiftType == $dayIndex0ShiftType),
+ contract == $contract, shiftDateDayOfWeek == $startDayOfWeek,
+ $employee : employee, $firstDayIndex : shiftDateDayIndex
+ )
+ Assignment(
+ eval($dayIndex1ShiftType == null) || (shiftType == $dayIndex1ShiftType),
+ employee == $employee,
+ shiftDateDayIndex == ($firstDayIndex + 1)
+ )
+ Assignment(
+ eval($dayIndex2ShiftType == null) || (shiftType == $dayIndex2ShiftType),
+ employee == $employee,
+ shiftDateDayIndex == ($firstDayIndex + 2)
+ )
+ Assignment(
+ eval($dayIndex3ShiftType == null) || (shiftType == $dayIndex3ShiftType),
+ employee == $employee,
+ shiftDateDayIndex == ($firstDayIndex + 3)
+ )
+ then
+ insertLogical(new IntConstraintOccurrence("unwantedPattern", ConstraintType.NEGATIVE_SOFT,
+ $pattern.getWeight(),
+ $employee, $pattern, $firstDayIndex));
+end
+
// ############################################################################
// Calculate score
// ############################################################################
More information about the jboss-svn-commits
mailing list