2

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?

4

1 回答 1

1

不要将 OneToMany 端设为计划变量,而是将 ManyToOne 端设为计划变量。如果您有 ManyToMany 方面,请在之间引入一个类(如在关系数据库设计中)并充当 ManyToOne-OneToMany。

在护士排班示例中,一个示例可能需要 4 名护士ShiftShiftDate1 月 1 日为ShiftTypeEarly。在这种情况下,ShiftrequiredEmployeeSize4 个,并且ShiftAssignments为该单个创建了4 个Shift,每个都有不同的indexInShift. 这样,ShiftAssignment就有一个计划变量Employee,它是一个多对一关系(即使两者之间Shift存在Employee多对多关系)。

于 2014-08-05T08:19:47.393 回答