Search code examples
optaplannertimefold

Entity Selection based on Feedback from Constraint Streams


We are working on a model that involves activating/deactivating locations on a supply chain, as well as defining inbound/outbound/production volumes. Each violation of supply/capacity impacts the hard score, and we would like to know the best approach to allow the solver to correctly identify the moves that will most probably solve the constraints.

Does the problem statement through the Constraint Streams API automatically orient the solver as to which are the key entities associated with the hard score violations? If the constraint streams are intended exclusively for score updates, without influencing move selection, what would be the most adequate solution?

  1. Assign probabilities to the entity selector in order to favor moves in constrained entities (probabilities based on their impact on the hard score)
  2. Use nearby selection : my concern here is how to solve the constraints if we drift away from the offending entities

Solution

  • What you're looking for would be a variant of guided local search. Unfortunately, neither OptaPlanner nor Timefold Solver currently support it.

    I am not entirely sure it can be implemented in the current state of things. One part of the solution would be the new score analysis feature of Timefold Solver. In your custom move selector, you'd have to ask for this analysis, read it and figure out from it which entities to target with that custom move.

    It is hard for me to say what issues you'll run into when you try doing this. If I had to guess, even if it is possible, it will likely be prohibitively slow on account of the constant analyzing of the score. Anyway, if you figure it out, we'd love to hear all about it in our Discussions.