本文介绍了如何在optaplanner中跟踪计划变量分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在计划过程中是否可以访问计划变量的分配?

Is there a way to access planning variable's assignment during planning?

在我的用例中,我只想在计划期间一次分配具有某些状态的计划变量.之后,我不想使用该计划变量.

In my use case, I want to assign a planning variable with certain status only one time only during planning. After that I don't want to use that planning variable.

我知道在optaplanner中,计划变量/问题事实无法更改,因此我无法更改其状态.

I know that in optaplanner, a planning variable/problem fact can not change, so i can not change its status.

是否有一种方法可以在计划过程中获取计划变量分配的列表,以便在Java代码或drools文件中,如果已使用一次,则可以避免重新分配?

Is there a way to get list of planning variable assignment during planning so that in java code or drools file, i can avoid re-assignment if it has been used once?

谢谢!

推荐答案

使用硬约束来强制实施.

是的,您也可以使用MoveFilters,但这不是一个好主意,因为有时您需要打破严格的约束条件才能逃脱局部最优.

Yes, you could use MoveFilters too, but that's not a good idea because sometimes you need to break hard constraints to escape local optima.

这篇关于如何在optaplanner中跟踪计划变量分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 23:59