elk-tamer
elk-tamer

Reputation: 316

Implementing vehicle routing problem with profits variant using Optaplanner

I'm trying to use Optaplanner to implement the "VRPP" variation, where all customers don't need to be delivered to.

It seems like the example code I'm use for time windowed VRP ensures that all customers are in the "chain". I want to make that optional and then add to the score if they are in the chain. (If the "profit" of visiting them improves the score more than the cost they would be in the chain.)

I had assumed the problem was initialized with a complete chain and then moves only swapped positions, but I can't where or if that is happening.

Has someone implemented VRPP with optaplanner?

Upvotes: 1

Views: 191

Answers (1)

Geoffrey De Smet
Geoffrey De Smet

Reputation: 27357

Read overcontrained planning in the docs, this about not having to assign all assignments.

Normally, you would be able to use nullable=true, but the new @PlanningListVariable doesn't support that yet, and neither do the old @PlanningVariable(CHAINED) (only if chained).

Introduce a dummy vehicle (with a field boolean dummy = true). Ignore the dummy vehicle for all hard and soft constraints. Use HardMediumSoftScore. Add a medium constraint to penalize all dummy vehicle assignments. Or instead add a medium/soft constraint summing the profit per assigned customer.

Upvotes: 1

Related Questions