0
votes

In a vehicle routing problem I want to eliminate the constraint that every customer must be served, but adding a prize for those who are served.

I'd like to add a virtual vehicle v_i for each customer c_i, such that v_i can serve only customer c_i, and when it happens it means that the customer is not served. Hence, when there are N customers, there are M real vehicles plus N virtual vehicles.

My doubt is: how can I set the valueRangeProviderRefs of the Customer class to avoid client c_j to be served by vehicle v_i, that is, can I make "vehicleRange" depend on a specific customer instead if refferring to a static List of vehicles?

1

1 Answers

0
votes

This is called overconstrained planning. Technically, @PlanningVariable(nullable=true) should allow this, but OptaPlanner 6.0 (and 6.1 currently too) does not support nullable for chained variables yet...

Workaround: Create 1 dummy Vehicle, which is ignored in all the score rules and add a score rule to reward any customer being serviced by a non-dummy Vehicle.