Liz S
Liz S

Reputation: 1

OptaPlanner customer-vehicle delivery restrictions

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

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?

Upvotes: 0

Views: 152

Answers (1)

Geoffrey De Smet
Geoffrey De Smet

Reputation: 27312

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;
    }
}

Upvotes: 1

Related Questions