Control number of trucks used in VRP

27 views
Skip to first unread message

James Nebeker

unread,
Sep 23, 2021, 9:52:34 PM9/23/21
to OptaPlanner development
Hey guys,

I've been modifying the base vrp example and I've got it to a point I'm happy with, but right now it seems like optaplanner picks the number of trucks to use by just doing a simple #/capacity. I need it do these things:

1) Get each vehicle as close to 8 hours of total drive time as it can
2) If a vehicle goes significantly over 8 hours, add another vehicle 
3) Assume I start with more than enough vehicles to cover the # of jobs
Can this be achieved? If so, how?

Geoffrey De Smet

unread,
Sep 27, 2021, 8:40:23 AM9/27/21
to optapla...@googlegroups.com

You can't add vehicles while solving, so you 'll need to provision vehicles you'd rather see end up empty.

Then, there are 2 ways to go, with different trade-offs:

A) An anti-loadbalacing score constraint (the negative of "fairness", see docs).
This is the easier than B).

XOR

B) A medium constraint to minimize non-empty vehicles.
That itself, won't work well: you'll also need custom moves to grab a vehicle and distribute its visits across the other vehicles.

With kind regards,
Geoffrey De Smet

--
You received this message because you are subscribed to the Google Groups "OptaPlanner development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to optaplanner-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/optaplanner-dev/ae007716-13fb-41c3-ad8c-83da8e069478n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages