A way to force the algorithm to utilize a fixed number of vehicles

Hi everyone!

In this issue related on how to force the algorithm to utilize a fixed number of vehicles : #239,
PGWelch wrote:

"It may be more reliable to actually modify the insertion and ruin heuristics a bit. Assuming you want n vehicles, for the initial solution construction, randomly choose n jobs, assigning one per vehicle and then apply cheapest or regret based construction to assign all other jobs and finish building the first solution. For subsequent ruin-and-recreate iterations, use a modified ruin which leaves at least a single job in place on each route (where the job is randomly chosen each time).

This kind of strategy would force the algorithm to always use n vehicles, but still allow it to optimise them."

Can someone please help me to code the above strategy?

Thanks

I don’t think this is a good idea / a good constraint to force the use of vehicles.

What are you modeling by this constraint? What is the reason that a vehicle “has to be used”?

The result will be something like this: some vehicles will, as before, do most of the work and the remaining vehicles will serve 1 stop each.

Instead, balancing might achieve what you want. Consider using global span constraints on dimensions you are interested in.

Hannes.

Hi Hannes.

Thank you for your reply.
My target is to reduce the transportation time that’s way I would like to force the algorithm to use all the vehicles that I set and to balance the transportation time across all these vehicles.
Do you have anything to suggest me in order to achieve that?
What do you mean by saying use “global span constraints on dimensions you are interested in”?

Thanks,
Nikos

Powered by Discourse