问题
Our current approach is running solver many times. I am wondering if there is a better approach.
Some explanation:
Vehicle Routing Problem with Multiple Trips (VRPMT): The vehicles can do more than one route.
回答1:
Take the VRP example, rename Vehicle
to VehiclePerDay
, then introduce 2 fields on it: the vehicle and the LocalDate. This is presuming one trip per day.
If you do multiple trips on the same day, there are 2 approaches:
1) Split Vehicle into VehicleTrip as above and have them point at the previous one. So the second trip leaves when the first trip of the same vehicle returns back to the depot (plus loading time)
2) Use shadow variable sum capacity usage until each visit and introduce "automatic" return back to depot moments. Basically, if a vehicle has a capacity of 10 and delivers to 5 locations with 3 items each, it looks like this:
- Vehicle A
- Visit 1: total capacity need 3, @ShadowVariable goBackToDepotFirst=false
- Visit 2: total capacity need 6, @ShadowVariable goBackToDepotFirst=false
- Visit 3: total capacity need 9, @ShadowVariable goBackToDepotFirst=false
- Visit 4: total capacity need 3, @ShadowVariable goBackToDepotFirst=true
- Visit 5: total capacity need 6, @ShadowVariable goBackToDepotFirst=false
来源:https://stackoverflow.com/questions/58952131/what-is-the-best-practice-for-solving-vrpmt-problem-with-optaplanner