We have modelled our vehicle routing problem with pickup and delivery as a chained planning problem. On top of that we have a custom move implementation which unlinks a pickup-delivery pair from the fleet and inserts it somewhere else.
Our chain is updated in a similar fashion as the ArrivalTimeUpdatingVariableListener from the optaplanner examples, starting from the changed planning entities and then proceeding incrementally up until the end of the chain.
We're facing the problem that the chain is being updated unnecessarily often. Since we announce 4 planning variable changes to the scoreDirector for each move, the variable listener performs a full chain update starting from each of these 4 planning entities. Often times all four entities are located in the same chain and one update starting from the first changed entity would be sufficient.
We already implemented an early exit: In case a specific shadow variable is not updated during the chain update we skip the remainder of the chain. However, this only works if by chance we first process the chain from the first entity.
How can we ensure that we only update the chain once per Move, starting from the first changed entity?