英文:
Is there a way in Optaplanner to deactivate a whole planning entity during planning if it is not needed?
问题
我有一组任务需要在Optaplanner中组织。每个任务都有两个计划变量:1)任务开始时间和2)任务持续时间。
然而,我并不需要安排所有的任务。为了考虑这一点,我添加了一个新的布尔变量“active”,它可以是True或False。为了减少搜索空间,我希望对于那些具有“active = False”的任务,算法不考虑另外两个计划变量(时间和持续时间)。
是否有一种方法可以实现这一点?
英文:
I have a set of tasks to organize in Optaplanner. Each task has 2 planning variables: 1) when the task starts and 2) how long it should be.
However, I do not need all the tasks to be scheduled. To account for this, I added a new Boolean variable "active", that can be True or False. To reduce the search space, I would like that for tasks that have "active = False" the algorithm does not consider the other two planning variables (time and duration).
Is there a way to achieve this?
答案1
得分: 2
在OptaPlanner和Timefold中,有两个概念适用:
前者允许您指定并非所有实体都需要分配(它们的变量可以保持为null
)。后者允许您指定实体不应被更改,其变量保持原始状态。
您正在寻找的解决方案将是两者的结合。话虽如此,我并不完全确定在求解器运行时更改固定值会发生什么。这是需要进行实验的事情。
英文:
In both OptaPlanner and Timefold, two concepts apply:
The former allows you to specify that not all entities need to be assigned. (Their variables may be left to null
.) The latter allows you to specify that an entity should not be touched at all, its variables be kept in the original state.
The solution you are looking for would be a combination of the two. That said, I am not entirely sure of what happens if you change the value of a pin while the solver is running. That is something that needs to be experimented with.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论