Search code examples
optaplanner

Conditional probability distribibution for nearbySelection [Optaplanner]


In a vrp problem, I want to employ different probability distribitions for all moveSelectors depending on where in the chain the planning is being done. More concretely, I want to employ a block distribution for the first entity in the chain and parabolic for anywhere else in the (same) chain.

Now, I could configure identical moves one with block distribution and one with parabolic, but this is going to get cluttered very quick. So, instead I am wondering what will happen if I state that in the implemented NearbyDistanceMeter the distance is 0 if it is the first entity in the chain and a value > 0 if it is not the first entity. Will this work as intended ?


Solution

  • It will not. The NearbyDistanceMeter should be idempotent (give the same result when called twice), regardless of the state of the planning variables. In fact, it's called & cached before solving really starts.