Im struggling with a constraint to check for minimum loads. I don’t think my requirement is unusual but my friend google has not found any similar issues or solutions. Let me explain.
Our trucks have different capacities and different minimum load values.
They also do, what I call, multiple “runs” per route and this is the trouble I have. That is to say a route might look like:
P1D1 P2BP3P4D2D3D4 B P5PD5
I have implemented both a hard constraint and a solution checker to try and ensure that undersized routes are allowed through.
Breaks are also scheduled
I need to make sure that the minimum load of each “run” is not too small.
In above route, assuming a minimum load of 10, Runs 1 and 3 are undersized and should not be allowed. Run 2 is ok.
The approach I have taken for the hard constraint is that whenever I see a Delivery newAct where the prevAct was NOT a delivery and the nextAct is NOT a delivery, I search backward up the route to get the last Pickup and I check the load at that point + the size of the proposed job. It does not work.
I believe an Activity based Hard Constraint is not appropriate because individual activities cannot be evaluated to qualify the “run”. For example if a newAct is the first job being added to the route and is undersized it is not reasonable to reject it as NOT_FULFILLED as there may be other jobs added later. Equally there may NOT be other jobs added later but there is no way to predict that. Also when a new “run” is started there is no way to say that the “previous run” is no good.
Using a Route based Hard Constraint, as I understand it, is still about a proposal to add a job but qualifying the whole route on the basis of adding the job.
What I think is needed is the ability, when a route is completed, to remove any inappropriate jobs from that route and mark them as unassigned, and accept the remainder of the route if there are good “runs” remaining. Alternatively, worst case, to reject the whole route as being not ok.
Is this thinking correct or am I missing something?
Is there a way to implement my proposed solution ?
Your help would be very much appreciated.