Hi,
Flow time or transit time, item time, parcel time, package time, etc. is the time between the pickup and the dropoff in each pickup and delivery pair.
Researching this I've seen a couple of posts here:
In general, flow time can be computed as given in 2. In my case, I have a good solution and acceptable convergence when I do not consider flow time. However, when I add it as hard constraint (as in 2.) the solver struggles to find a feasible solution. So I was thinking about going with 3. and adding it as soft constraint. So I want to penalize when the flow time exceeds a certain limit. Thus, I have the following, a seperate dimension:
> routing.AddConstantDimensionWithSlack(0, int.MaxValue, int.MaxValue, true, "Flowtime");
and then several constraints for all dropoffs where such a limit applies:
> excessFlowTime = (timeDim.CumulVar(dropoffIndex) -
timeDim .CumulVar(pickupIndex)) - limit; // this is negative when below the limit
> solver.Add(flowTimeDim.SlackVar(dropoffIndex) >= excessFlowTime);
and then later for every vehicle i:
> flowTimeDim.SetCumulVarSoftUpperBound(routing.End(i), 0, 1000);
The problem is that if I do this even for a single dropoffIndex the convergence speed becomes unusably slow (there are about 70 pickup-dropoff pairs in the model). The exploration of neighbors seems to come to a crawl, e.g. when it's about 64,000 neighbors per second without flow time it is only 1,000 neighbors with the constraint. As my model typically takes an hour to come to a very good solution, this would thus require about 64 hours instead!
I also tried to compute excessFlowTime as solver.MakeMax(..., 0) and using an equality instead of the inequality, but no difference really.
Is there something I can change in the model to make it converge faster? The constraint seems to make neighborhood exploration much more expensive.
Thanks,
Andreas