我是一名信息学护士,试图开发一种用于护理排班的机器辅助流程。一半的员工在其他地方工作,所以我们的主要限制是他们在他们工作的其他机构的日程安排。我们在 20 日收到此信息。每个月,所以我们有 10 天的时间提前计划。硬约束将是他们在其他工作中分配的班次,不遵循任何模式,因此我们需要“手动”从日历中划掉那些日子,然后计算解决方案(考虑到其他限制,例如在夜班、放假前不夜班等)。您认为这样的实现对于 Optaplanner 是否可行?
问问题
2034 次
2 回答
1
只需使用 OptaPlanner 的护士排班示例(视频)并根据您的需要调整约束(可能还有领域模型)。但是,要做到这一点,它需要一些 Java 编程技能。
护士排班的源代码,您可以在其中添加其他约束类型:
于 2014-08-22T08:18:54.783 回答
0
Cecilia,这里有一些约束,我在我的排班应用程序中使用 optaplanner 库。您可以将此规则添加到 NurseRosteringScoreRules.drl 文件中,并且不需要实现约束类型。我希望对你有所帮助。
rule "No dos tareas iguales el mismo dia al mismo empleado"//"oneShiftPerDay" Modificada, la antigua, hay que quitarla.
when
$leftAssignment : ShiftAssignment($leftId : id, $employee : employee, $shiftDate : shiftDate, $shiftType : shiftType, employee != null)
$rightAssignment : ShiftAssignment(employee == $employee, shiftDate == $shiftDate, $shiftType == shiftType, id > $leftId)
then
scoreHolder.addHardConstraintMatch(kcontext, -1);
end
rule "No Noche-Libre en días consecutivos"
salience 1
when
ShiftAssignment(
shiftType.code == "N",
$employee : employee, $shiftDate : shiftDate, employee != null)
DayOffRequest(employee == $employee, shiftDate.dayIndex == ($shiftDate.dayIndex + 1))
then
scoreHolder.addHardConstraintMatch(kcontext, -1);
end
rule "No Noche-Mañana en días consecutivos"
salience 2
when
ShiftAssignment(
shiftType.code == "N",
$employee : employee, $shiftDate : shiftDate, employee != null)
ShiftAssignment(
shiftType.code == "M",
employee == $employee, shiftDate.dayIndex == ($shiftDate.dayIndex + 1)
)
then
scoreHolder.addHardConstraintMatch(kcontext, -1);
end
rule "No Noche-Tarde en días consecutivos"
salience 2
when
ShiftAssignment(
shiftType.code == "N",
$employee : employee, $shiftDate : shiftDate, employee != null)
ShiftAssignment(
shiftType.code == "T",
employee == $employee, shiftDate.dayIndex == ($shiftDate.dayIndex + 1)
)
then
scoreHolder.addHardConstraintMatch(kcontext, -1);
end
rule "No Mañana-Tarde en el mismo día"
when
$leftAssignment : ShiftAssignment($leftId : id, $employee : employee,
$shiftDate : shiftDate, $shiftType : shiftType, employee != null)
$rightAssignment : ShiftAssignment(employee == $employee,
shiftDate == $shiftDate, shiftType.code == "T", $shiftType.code == "M", id > $leftId)
then
scoreHolder.addHardConstraintMatch(kcontext, -1);
end
rule "No Tarde-Noche en el mismo día"
when
$leftAssignment : ShiftAssignment($leftId : id, $employee : employee,
$shiftDate : shiftDate, $shiftType : shiftType, employee != null)
$rightAssignment : ShiftAssignment(employee == $employee,
shiftDate == $shiftDate, shiftType.code == "N", $shiftType.code == "T", id > $leftId)
then
scoreHolder.addHardConstraintMatch(kcontext, -1);
end
于 2015-12-10T10:52:36.550 回答