OptaPlanner 升级到 TimeFold 会导致可空值的行为差异

问题描述 投票:0回答:1

我有一个用

@PlanningVariable(nullable = true)
注释的计划变量。我正在使用穷举搜索(强力),因为这是用于单元测试,我需要确保每次结果都相同。

我打开了跟踪日志记录以查看搜索是如何发生的。

在 OptaPlanner 9.44.0 中,搜索的开头如下所示:

Move treeId (1-0), score (null), expandable (true), move ({null -> null}).
Move treeId (1-1), score (null), expandable (true), move ({null -> <something not null>}}).
Move treeId (1-2), score (null), expandable (true), move ({null -> <something not null>}).
Move treeId (1-3), score (null), expandable (true), move ({null -> <something not null>}}).

在 TimeFold 1.2.0 中,搜索的开始看起来像这样:

Move (... {null -> null}) filtered out by a selection filter (Doable moves only).
Move treeId (1-0), score (null), expandable (true), move (... {null -> <something not null>}).
Move treeId (1-1), score (null), expandable (true), move (... {null -> <something not null>}).
Move treeId (1-2), score (null), expandable (true), move (... {null -> <something not null>}).

不同的是,TimeFold 中过滤掉了空赋值。

我需要将 null 作为搜索的一部分。我没有定义任何选择过滤器——这只是默认行为。如何让 null 包含在搜索中?或者也许我误解了输出的含义? (但肯定是在 OptaPlanner 中通过的一堆测试在 TimeFold 中失败了。)

optaplanner timefold
1个回答
0
投票

最近 Timefold 发生了变化,很可能就是这样做的。如果您的计划变量是

nullable
,那么这看起来像是一个错误。

让我们继续讨论Github

© www.soinside.com 2019 - 2024. All rights reserved.