Pravesh Jain
Pravesh Jain

Reputation: 4288

Optaplanner: Termination strategy when all constraints not satisfied

I am using optaplanner for solving a problem similar to employee assignment. All of my constraints may not be satisfied - I just want the best possible solution.

What is a good termination strategy for this?

If I use unimprovedSecondsSpentLimit, it compromises the reproducibility of the solution.

I am thinking of using unimprovedSecondsSpentLimit but don't know what value to use with it? Also, I see in documentation that this can also be used for a phase. What does that mean? I am not defining any phases myself.

Upvotes: 0

Views: 114

Answers (1)

k88
k88

Reputation: 1934

You can configure a solver to exist out of multiple layers, these are typically called phases. Each phase is a seperate optimization step and you can configure it how you desire (e.g. stop after 30 seconds, stop after 200 unimprovedSteps, etc.). Hence each phase can have its own termination criteria. (This is aside from the sovler termination criteria)

Regarding finding a good termination strategy, you should use Optaplanner's benchmarker module. Load multiple datasets and try different values for unimprovedSecondsSpentLimit. See what configuration returns the most desired solutions consistently. Hope this helps.

Upvotes: 1

Related Questions