0

I am using OptaPlanner for vehicle routing and scheduling. I'd like to include the concept of customer-vehicle restrictions.

  • Example 1: customers specified as mechanised customers can only receive delivery from vehicles that have been specified as mechanised (e.g. vehicles with forklifts, hydraulic tail lifts, etc.)
  • Example 2: customers have physical constraints on their premises and can only accept delivery from vehicles under a certain size.

In general terms a group of customers should receive delivery from a group of vehicles. Any vehicles that do not meet the criteria should not be considered for delivery to these customers.

I've searched the forum, but don't see any questions for the same scenario. Can anyone assist?

Yogesh Seralia
  • 340
  • 5
  • 23
Liz S
  • 1
  • 2

1 Answers1

1

Add a hard constraint, for example in DRL

when
  Customer(vehicleOk == false)
then
  ... // penalize hard score
end

with a class that looks like this:

class Customer {
    private boolean needsMech;

    private Vehicle vehicle; // Anchor shadow variable
    ...

    public boolean isVehicleOk() {
        if (needsMech && !vehicle.isMech()) {
            return false;
        }
        if (...) { // size limitation
            return false;
        }
        return true;
    }
}
Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120