I am looking into the example use cases from OptaPlanner. And I could not find any similar example which can solve multiple planning variables in one planning entity. For example, in nurse rostering, each ShiftAssignment(PlanningEntity)
for one shift might require multiple assigned Employee(PlanningVariables)
. In this case, how can we make use of planner and write rules?
问问题
897 次
1 回答
1
不要将 OneToMany 端设为计划变量,而是将 ManyToOne 端设为计划变量。如果您有 ManyToMany 方面,请在之间引入一个类(如在关系数据库设计中)并充当 ManyToOne-OneToMany。
在护士排班示例中,一个示例可能需要 4 名护士Shift
在ShiftDate
1 月 1 日为ShiftType
Early。在这种情况下,Shift
有requiredEmployeeSize
4 个,并且ShiftAssignments
为该单个创建了4 个Shift
,每个都有不同的indexInShift
. 这样,ShiftAssignment
就有一个计划变量Employee
,它是一个多对一关系(即使两者之间Shift
存在Employee
多对多关系)。
于 2014-08-05T08:19:47.393 回答