reinterpretcat / vrp

A Vehicle Routing Problem solver
https://reinterpretcat.github.io/vrp/
Apache License 2.0
331 stars 68 forks source link

Advice on the best way to model balanced activities with many tasks per job? #92

Closed Esya closed 1 year ago

Esya commented 1 year ago

I am trying to model a fleet of engineers going to buildings to service a certain number of equipments. The number of equipments varies per building, but I would like overall that each engineer has a similar amount of equipments to care for in their tour - and that only one engineer takes care of a specific building through the planning horizon (without specifying which one, so can't use constraints there).

I initially had one job per equipment - so multiple jobs per building, with a single service task - but it can generate a solution with multiple engineers sharing the same building - which I do not want.

I then moved to using multiple service tasks inside a single job per building, but I get massive performance drawbacks - I do not even have the initial solution after 30 minutes with 650 jobs/20 vehicles (Some of those jobs have 25+ service tasks) and I have not even waited long enough to see any generation come up - while with 1900 jobs with a single task I had results in seconds

I could have a single task with an increased duration relative to the number of equipment - but then I would not be able to use balance-activities as an objective since each building would equal 1.

Would you have a recommendation as the most efficient way to model this ?

reinterpretcat commented 1 year ago

I've briefly checked your description (about to go offline before going to sleep), will group constraint on job serve your purpose more efficient than multi-job (yes, it has obvious performance drawback)? The group feature works differently, it has just one implication for one of the most effective inner heuristics which is based on divide and conquer principle, but should work fine I believe.

From docs:

group (optional): a group name. Jobs with the same groups are scheduled in the same tour or left unassigned.

https://reinterpretcat.github.io/vrp/concepts/pragmatic/problem/jobs.html#job

Alternative approach could be one you mentioned (with increased duration), but you play with aggregated demand on the whole building job and use balance-max-load objective instead of balance-activities.

Esya commented 1 year ago

Ah - those are two very good paths forward indeed, thanks! I've changed from service to pickups and use aggregated demands, and it seems to work well indeed - I'll also try out the group approach to see which one performs best for my usecase. Once again, thank you for your help