英文:
Optaplanner / Timefold - employee roster stuck on poor allocation
问题
我已经继承了一个基于Optaplanner的员工排班系统。它主要基于Optaweb示例。
我已经更新到使用Optaplanner 9.41.0.Final,并将很快尝试升级到Timefold,尽管我怀疑这不会解决问题。
我遇到的问题是求解器卡住了。资源分配非常简单:
- 3名员工
- 1名员工(Wendy Weekend)希望在周末工作,不希望在工作日工作。
- 另外两名员工没有特定的可用性设置。
当我启动求解器时,Wendy被分配到她首选的周末班次和许多工作日班次。其他班次分配给其他两名员工,而第三名员工,本应更适合在工作日班次工作,却没有被分配到任何班次。
如果这种不良分配在更新和改进后变得有意义,那就可以理解。但是求解器似乎卡住了。
调试输出一直在重复以下内容:
2023-07-10 14:58:57,452 DEBUG [org.opt.cor.imp.loc.DefaultLocalSearchPhase] (pool-5-thread-1) LS step (4213), time spent (15807), score (0hard/-18medium/-67200soft), best score (0hard/-18medium/-67200soft), accepted/selected move count (1/8), picked move (Cafe 2023-07-15T00:00+12:00-2023-07-16T00:00+12:00 {null} <-> Cafe 2023-07-15T00:00+12:00-2023-07-16T00:00+12:00 {Andy}).
2023-07-10 14:58:57,458 DEBUG [org.opt.cor.imp.loc.DefaultLocalSearchPhase] (pool-5-thread-1) LS step (4214), time spent (15813), score (0hard/-18medium/-67200soft), best score (0hard/-18medium/-67200soft), accepted/selected move count (1/164), picked move (Cafe 2023-07-14T00:00+12:00-2023-07-15T00:00+12:00 {Andy} <-> Cafe 2023-07-14T00:00+12:00-2023-07-15T00:00+12:00 {null}).
员工Andy
是唯一没有被分配到任何工作的人。他没有指定的可用性(希望/不希望)并且与其他2名员工拥有相同的合同。
我如何更好地理解它为什么卡住了?并且是否有任何明显的建议可以解决这个问题?
当我开始时...
英文:
I've inherited a Optaplanner based employee roster system. It is largely based on the Optaweb example.
I've updated it to use Optaplanner 9.41.0.Final and will soon try to upgrade to Timefold, although I'm suspecting that this will not solve the issue.
The issue I'm experiencing is the solver is stuck. The resourcing is very simple:
- 3 employees
- 1 employee (Wendy Weekend) has a desire to work weekends and undersirable to work during the week.
- The other two have no specific availability settings.
When I begin the solver Wendy is assigned to (a) her preferred weekend shift and many week shifts. The other shifts are allocated to one of the others, and the third, who would be better to do the week day shifts, doesnt get any assigned shifts.
This poor assignment would make sense if it was updated and improved. But the solver seems to be stuck.
The debugging output is repeating the following:
2023-07-10 14:58:57,452 DEBUG [org.opt.cor.imp.loc.DefaultLocalSearchPhase] (pool-5-thread-1) LS step (4213), time spent (15807), score (0hard/-18medium/-67200soft), best score (0hard/-18medium/-67200soft), accepted/selected move count (1/8), picked move (Cafe 2023-07-15T00:00+12:00-2023-07-16T00:00+12:00 {null} <-> Cafe 2023-07-15T00:00+12:00-2023-07-16T00:00+12:00 {Andy}).
2023-07-10 14:58:57,458 DEBUG [org.opt.cor.imp.loc.DefaultLocalSearchPhase] (pool-5-thread-1) LS step (4214), time spent (15813), score (0hard/-18medium/-67200soft), best score (0hard/-18medium/-67200soft), accepted/selected move count (1/164), picked move (Cafe 2023-07-14T00:00+12:00-2023-07-15T00:00+12:00 {Andy} <-> Cafe 2023-07-14T00:00+12:00-2023-07-15T00:00+12:00 {null}).
Employee Andy
is the one who does not get any assignments. He has no specified Availability (desired / undesired) and has the same contract as the other 2 employees.
How can I better understand why it is stuck? And are there any obvious suggestions on how to un-stuck it?
When I being the
答案1
得分: 1
在不了解数据集或领域模型的情况下,我实际上无法提供具体建议。因此,我将提供处理局部最优解的通用建议:
- 确保现有约束不会引入分数陷阱。
- 引入额外的约束以更好地区分可能的解决方案。
- 检查硬编码的约束。
- 引入额外的移动方式,以帮助求解器更好地探索搜索空间。
- 使用基准测试工具来调整求解器以更好地适应您的用例。
您可以在Timefold文档中找到更多关于这些主题的信息。
英文:
Without understanding the data set or the domain model, there really is no specific advice I can give. So I will give generic advice for dealing with local optima:
- Make sure existing constraints do not introduce score traps.
- Introduce additional constraints to better differentiate possible solutions from one another.
- Check for hard-coded constraints.
- Introduce additional moves to help the solver explore more of the search space.
- Use the benchmarker to tweak the solver to work better for your use cases.
You can find more about these topics in Timefold Documentation.
答案2
得分: 0
我不确定问题是什么。然而,升级/迁移至Timefold解决了问题。
升级/迁移至Timefold的说明可在https://stackoverflow.com/a/76260016/265119上查看。
英文:
I'm not sure what the problem was. However, upgrading / migrating to Timefold resolved the issue.
Instructions on upgrading / migrating to Timefold are viewable at https://stackoverflow.com/a/76260016/265119
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论