Search code examples
optaplanner

Optaplanner termination strategy


In the opta planner configuration ,there is a provision to specify the termination time out.

Is there a better way to handle the termination time out strategy? For example , my problem size is small and I have set the termination time out as 10 sec.

But I can see from the logs that the best score is obtained well within 2 - 3 seconds. Is there any means to exit once the best score is reached ?

Or should the program always run till the timeout is reached and then output the best score.


Solution

  • Take a look at the Termination chapter in the OptaPlanner documentation.

    What you are referring to is called BestScoreTermination but it might not be what you actually want -- do note that OptaPlanner has no way of knowing if the score is "the optimal score"... unless you configure Exhaustive Search (which doesn't scale well).

    Therefore, if you misjudge your problem and set the BestScoreTermination to something "better" than the optimal value, OptaPlanner will run until it tries out all combinations (which might take effectively forever on big problems). If you're looking for a compromise, take a look at "termination composition"