Hi,
I am trying to solve a Vehicle Routing Problem (VRP) with pickup and delivery constraints and a capacity constraint. Specifically, I want to implement a soft upper bound on the capacity, which penalizes the vehicle if it attempts to pick up more than the available capacity.
Here is my code:
capacity_dimension.SetCumulVarSoftUpperBound(index, soft_limit, penalty)
Unfortunately, this approach doesn't work as intended. The soft upper bound is checked before the pickup. This allows the vehicle to break the capacity constraint without incurring a penalty. For example, if the capacity limit is 20 before a pickup and a node requires a pickup of 10, the vehicle's current load may be 19. After this pickup, the vehicle's load would be 29, exceeding the limit by 9, but the penalty is not applied.
Could you provide guidance on how to correctly implement this constraint so that the penalty is applied when the vehicle's capacity is exceeded after the pickup?