0

I've inherited a Optaplanner based employee roster system. It is largely based on the Optaweb example.

I've updated it to use Optaplanner 9.41.0.Final and will soon try to upgrade to Timefold, although I'm suspecting that this will not solve the issue.

The issue I'm experiencing is the solver is stuck. The resourcing is very simple:

  • 3 employees
  • 1 employee (Wendy Weekend) has a desire to work weekends and undersirable to work during the week.
  • The other two have no specific availability settings.

When I begin the solver Wendy is assigned to (a) her preferred weekend shift and many week shifts. The other shifts are allocated to one of the others, and the third, who would be better to do the week day shifts, doesnt get any assigned shifts.

This poor assignment would make sense if it was updated and improved. But the solver seems to be stuck.

The debugging output is repeating the following:

2023-07-10 14:58:57,452 DEBUG [org.opt.cor.imp.loc.DefaultLocalSearchPhase] (pool-5-thread-1)     LS step (4213), time spent (15807), score (0hard/-18medium/-67200soft),     best score (0hard/-18medium/-67200soft), accepted/selected move count (1/8), picked move (Cafe 2023-07-15T00:00+12:00-2023-07-16T00:00+12:00 {null} <-> Cafe 2023-07-15T00:00+12:00-2023-07-16T00:00+12:00 {Andy}).
2023-07-10 14:58:57,458 DEBUG [org.opt.cor.imp.loc.DefaultLocalSearchPhase] (pool-5-thread-1)     LS step (4214), time spent (15813), score (0hard/-18medium/-67200soft),     best score (0hard/-18medium/-67200soft), accepted/selected move count (1/164), picked move (Cafe 2023-07-14T00:00+12:00-2023-07-15T00:00+12:00 {Andy} <-> Cafe 2023-07-14T00:00+12:00-2023-07-15T00:00+12:00 {null}).


Employee Andy is the one who does not get any assignments. He has no specified Availability (desired / undesired) and has the same contract as the other 2 employees.

How can I better understand why it is stuck? And are there any obvious suggestions on how to un-stuck it?

When I being the

Magick
  • 4,603
  • 22
  • 66
  • 103

2 Answers2

1

Without understanding the data set or the domain model, there really is no specific advice I can give. So I will give generic advice for dealing with local optima:

  • Make sure existing constraints do not introduce score traps.
  • Introduce additional constraints to better differentiate possible solutions from one another.
  • Check for hard-coded constraints.
  • Introduce additional moves to help the solver explore more of the search space.
  • Use the benchmarker to tweak the solver to work better for your use cases.

You can find more about these topics in Timefold Documentation.

Lukáš Petrovický
  • 3,945
  • 1
  • 11
  • 20
0

I'm not sure what the problem was. However, upgrading / migrating to Timefold resolved the issue.

Instructions on upgrading / migrating to Timefold are viewable at https://stackoverflow.com/a/76260016/265119

Magick
  • 4,603
  • 22
  • 66
  • 103