我想强迫每位护士在2周内进行9个班次。硬约束。我还想在夜班后强制执行3天的休息日。这两方面对护士来说都是严格的限制。请问以下工作
salience 1 // Do these rules first (optional, for performance)
when
$contractLine : MinMaxContractLine(contractLineType == ContractLineType.TOTAL_ASSIGNMENTS, enabled == true,
$contract : contract)
$employee : Employee(contract == $contract)
accumulate(
$assignment : ShiftAssignment(employee == $employee);
$total : count($assignment)
)
then
int totalInt = $total.intValue();
if ($contractLine.isMinimumEnabled() && totalInt < $contractLine.getMinimumValue()) {
scoreHolder.addHardConstraintMatch(kcontext,
(totalInt - $contractLine.getMinimumValue()) * $contractLine.getMinimumWeight());
} else if ($contractLine.isMaximumEnabled() && totalInt > $contractLine.getMaximumValue()) {
scoreHolder.addHardConstraintMatch(kcontext,
($contractLine.getMaximumValue() - totalInt) * $contractLine.getMaximumWeight());
} else {
// Workaround for https://issues.jboss.org/browse/PLANNER-761
scoreHolder.addHardConstraintMatch(kcontext, 0);
}