Search code examples
optaplanner

Getting ScoreExplanation during/after a Custom Move


My solution is for VRPTW and I've created a Custom Move.

After a custom move has been tried (prior to being accepted), I would like to see a score breakdown of it (not just the score itself).

Where is a good location to use ScoreExplanation to see the detailed score breakdown? Eg. in my AbstractMove implementation somewhere?

I have TRACE mode on and can see the score. I've tried pulling it up upon the next custom move being run and it seemed to be working since it was retrieving the correct score from the previous custom move, but when I looked at the ScoreExplanation, it looks completely off (it doesn't add up to the score).


Solution

  • Score explanations are not designed to be used inside of a step, they are far too slow for that. You are free to use the ScoreManager API any time you like, but you will pay a heavy performance penalty if you do that on the solver thread or the move threads.