为什么 ScoreManager 将解决方案更改为更差的分数?
Why is ScoreManager changing the solution to a worse score?
我正在使用 solverManager 不断保存最好的分数:
solverManager.solveAndListen(
SINGLETON_TIME_TABLE_ID,
this::findById,
this::save
)
我的 save() 方法只是更新对最佳解决方案的全局引用,没有其他任何事情发生。
但是,当我去检索最佳解决方案并获取分数详细信息时,它并不总是获得最佳解决方案:
val solution: MySolution = findById(SINGLETON_TIME_TABLE_ID)
println(solution.score) // prints 1100
scoreManager.updateScore(solution) // Sets the score
println(solution.score) // prints 1020 (it's now worse than before)
简单地调用 scoreManager.updateScore(solution)
似乎会带来更糟糕的解决方案。在上面的示例中,分数可能从 1100 下降到 1020。对此有明显的解释吗?
我正在使用 SimpleScore
,在分配所有计划变量后,这种情况发生得很好。
我正在使用可变侦听器 ArrivalTimeUpdatingVariableListener : VariableListener
。
不确定还有什么相关的。谢谢
这具有乐谱损坏的所有警告信号。请 运行 您的求解器 <environmentMode>FULL_ASSERT</environmentMode>
几分钟。如果您看到异常被抛出,您就知道您的约束中存在错误。那个错误是什么,除非我看到这些限制,否则我不可能知道。
我正在使用 solverManager 不断保存最好的分数:
solverManager.solveAndListen(
SINGLETON_TIME_TABLE_ID,
this::findById,
this::save
)
我的 save() 方法只是更新对最佳解决方案的全局引用,没有其他任何事情发生。
但是,当我去检索最佳解决方案并获取分数详细信息时,它并不总是获得最佳解决方案:
val solution: MySolution = findById(SINGLETON_TIME_TABLE_ID)
println(solution.score) // prints 1100
scoreManager.updateScore(solution) // Sets the score
println(solution.score) // prints 1020 (it's now worse than before)
简单地调用 scoreManager.updateScore(solution)
似乎会带来更糟糕的解决方案。在上面的示例中,分数可能从 1100 下降到 1020。对此有明显的解释吗?
我正在使用 SimpleScore
,在分配所有计划变量后,这种情况发生得很好。
我正在使用可变侦听器 ArrivalTimeUpdatingVariableListener : VariableListener
。
不确定还有什么相关的。谢谢
这具有乐谱损坏的所有警告信号。请 运行 您的求解器 <environmentMode>FULL_ASSERT</environmentMode>
几分钟。如果您看到异常被抛出,您就知道您的约束中存在错误。那个错误是什么,除非我看到这些限制,否则我不可能知道。