3

I have a question related to the OptaPlanner's solver. Is it possible to count the total number of solutions evaluated by the solver during the runtime? I mean the solutions themselves, not their score.

gadzix90
  • 744
  • 2
  • 13
  • 28
  • 2
    Take a look at the concept of "steps" in the documentation. Also, try enabling a more "low-level" logging level and looking at the log :) – Ondrej Skopek Feb 13 '16 at 11:02
  • @oskopek thank you for your answer. It seems that logging level is what I was looking for. Just to be 100% sure that I understand "step" term correctly - does a single step stand for a single evalueated solution? I've seen in the documentation that each step performs some moves - should I consider them as evalueated solutions too? – gadzix90 Feb 13 '16 at 13:00
  • Technically, yes. Not sure if they're globally unique across the whole run though (I'd say they aren't). – Ondrej Skopek Feb 13 '16 at 13:31
  • @oskopek sorry, but yes to what? Yes to 'step = evaluated solution' or to 'move = evaluated solution'? Thanks a lot! – gadzix90 Feb 13 '16 at 13:43
  • 1
    Yes to "move == evaluated solution". A step is the chosen move. You have to understand, that different moves may reach the same state, i.e. that states do not *directly* correspond to moves. (There can be two sequences of different steps/moves, that lead to the same state after executing all of them) – Ondrej Skopek Feb 13 '16 at 16:09

1 Answers1

1

The number of evaluated solutions would roughly equal to InnerScoreDirector.getCalculateCount() (which is the number of evaluated moves, see Ondrej's comments too). There's no guarantee that those solutions would be distinct, but for medium to large use cases, making them distinct will not affect the number much.

This presume the environmentMode is not set to asserting, because in the asserting case the calculateCount can also be incremented for each undo move and each step.

Debug logging outputs the "average calculate count per second" as the last log line of the solver. And the Benchmarker report has a summary graph for that number.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
  • Note that the calculate count per second very heavily depends on the score calculation type you use (easy java vs drools vs incremental java). – Geoffrey De Smet Feb 16 '16 at 13:57