In the VRP examples of Optaplanner, I would like to force some customer to be serviced by a specific vehicle in VRP.
How to do this? Can anyone help me?
There are several ways. The easiest is probably just to add a hard constraint
when
Customer(forcedVehicleIsNotVehicle == true)
then
scoreHolder.addHardConstraint...
end
class Customer {
public boolean isForcedVehicleIsNotVehicle() {
return forcedVehicle != null
&& vehicle != null && forcedVehicle != vehicle;
}
}