0

Similar to OptaPlanner: How to add a planning entity with ProblemFactChange

I have a long running solver where the contents of an order may change during solving. How do I introduce that change to the solver using a ProblemFactChange? ScoreDirectory has beforeEntityAdded/afterEntityAdded and beforeEntityRemoved/afterEntityRemoved methods, but I don't see any for changing an existing entity.

Should I just queue a remove followed by an add?

Community
  • 1
  • 1
Mitch
  • 989
  • 1
  • 9
  • 25

1 Answers1

0

No need to remove + add, as that's a (insignificant?) perf loss.

Instead, just call before/afterProblemFactChanged once for all non planning variable field changed and before/afterVariablechanged for every genuine/shadow variable field changed.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120