简体   繁体   中英

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. 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. 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.

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)
  • Easy: score calculation speed (3221/sec)

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.

Thank you

Higher score calculation speed is better.

Note that:

  • Turning FAST_ASSERT or FULL_ASSERT slows it down immensely. 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. See docs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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