Reputation: 397
We know that OptaPlanner does multiple steps' calculations before selecting one step which generating the highest score to update the best solution, as the debug log shows e.g. [main] DEBUG o.o.c.i.c.DefaultConstructionHeuristicSolverPhase - Step index (1147), time spend (4381), score (0hard/80504soft), selected move count (15) for constructing step...
I am trying to get the move which was selected (or at least to get a notification) so that I can capture some intermediate calculation results. Apparently printing out all calculation results for each single step is not feasible as many of them were not selected.
I was looking at the BestSolutionChangedEvent method but seems it might not fit my purpose as per this thread: How to know Optaplanner solving has ended?
Is there any idea of how to achieve that? Thanks in advance.
Upvotes: 0
Views: 471
Reputation: 27312
Before answering the actual question, is this really useful? Suppose the follow scenario:
Now, what do you get if you just take the move that leads to the new best solution?
So that isn't useful, unless of course you just want to understand which moves are good. But in that case, take a look at the Benchmarker's Picked move type best score diff over time statistic, new in 6.2.
Now to answer your question :) There's no public API to do it, but you can use the internal (non-backward compatible) implementation classes, as done in this class.
Upvotes: 1