Search code examples
optaplannertimefold

Understanding Resource Allocation: Seeking Insights into the 'Why' and 'How'


We are using timefold for resource allocation

Is there a way to gain insight into the resource allocation by the timefold application and effectively communicate the rationale behind it?

This detail may be needed for our own understanding or to explain it to the business or to the allocated resource.

What I have tried so far:

Tried logging the solutionManager:

solutionManager.explain(solution)

Tried logging the score analysis:

ScoreAnalysis<HardSoftScore> analysis = solutionManager.analyze(solution);

With the above details, I've tried to deduce the resource allocation, but couldn't derive the allocation logic, as it not only depends on the constraints, but also on the algorithm.


Solution

  • For the "how", you can use DEBUG or TRACE logging, which shows what moves the solver tries and considers. For the "why", the simple answer is that it is the best solution (according to the constraints) the solver found before termination. This is influenced by the solver configuration, which controls the algorithms the solver use for construction heuristic, local search, and move selection. You can use the benchmarker to find the solver configurations that works the best for your data sets (and see useful graphs such as how the score improves over time or what each constraint contributes to the best solution's score over time).