简体   繁体   English

Optaplanner Easy与增量分数计算速度

[英]Optaplanner Easy vs Incremental Score Calculation Speed

I first wrote an easy score calculator while getting to grips with Optaplanner adding in the hard and soft constraints as needed. 我首先编写了一个简单的分数计算器,同时又掌握了Optaplanner的功能,根据需要添加了硬约束和软约束。 Once I had that working I converted it into an incremental score calculator running many tests and using the built in FULL_ASSERT environment to ensure it was working as expected and producing the same score as the easy score calculator. 工作完成后,我将其转换为运行许多测试并使用内置FULL_ASSERT环境的增量分数计算器,以确保其按预期方式工作并产生与简易分数计算器相同的分数。 I then turned off FULL_ASSERT and changed logging to info only and ran the solver first with the incremental calculator and then with the easy calculator. 然后,我关闭FULL_ASSERT并将日志记录更改为仅信息,然后首先使用增量计算器,然后使用简单计算器来运行求解器。

In the log, I see the 'score calculation speed' but I cannot find in the documentation whether a higher figure is better or worse or whether the 2 scoring calculators can be compared in that way. 在日志中,我看到了“得分计算速度”,但我无法在文档中找到更高的数字是好是坏,还是可以用这种方式比较两个得分计算器。 It has me confused because in my mind a higher figure per second should be better but if that is the case then my incremental calculator is way slower than the easy one. 这让我感到困惑,因为在我看来,每秒更高的数字应该会更好,但是如果是这种情况,那么我的增量计算器就会比简单的计算器慢得多。

Does anyone know which is better out of the below two or if they should not even be compared this way?: 有谁知道下面两个中哪个更好,或者是否不应该这样比较?

  • Incremental: score calculation speed (1513/sec) 增量:分数计算速度(1513 /秒)
  • Easy: score calculation speed (3221/sec) 简易:分数计算速度(3221 /秒)

Looking at the code I can see the calculation count (which this figure is based on) is incremented each time setCalculatedScore is called, however, it could just mean that the incremental score calculator doesn't have to set it as often, not knowing how it works. 查看代码,我可以看到每次调用setCalculatedScore时,计算计数(该数字基于该值)都会增加,但是,这可能只是意味着增量分数计算器不必经常设置它,而不知道如何有用。

Thank you 谢谢

Higher score calculation speed is better. 分数计算速度越高越好。

Note that: 注意:

  • Turning FAST_ASSERT or FULL_ASSERT slows it down immensely. 转动FAST_ASSERT或FULL_ASSERT会极大地减慢其速度。 Maybe you forgot to turn that off for the incremental's benchmark run. 也许您忘了为增量版的基准测试关闭该功能。
  • You can validate the incremental one better by adding an <assertionScoreDirectorFactory> element that includes the easy one. 您可以通过添加包含简单元素的<assertionScoreDirectorFactory>元素来更好地验证增量元素。 See docs. 参见文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM