简体   繁体   中英

Optaplanner CVRPTWPD: Is it possible to have variable service duration depending on tour state?

I'm currently looking into Optaplanner to solve a CVRPTWPD (Capacitated vehicle routing problem with time windows and pickup and delivery). At each location I have to perform a service (loading or unloading of shipments) which takes time.
I want to model the depot as n locations (if there are n customer locations), so each customer location has corresponding depot location for the modelling of pickup and delivery.

The problem I face is the following:
If the vehicle starts at the depot, I do not want to take any time for loading or unloading into account (simulating that the transporter is already loaded with the planned shipments in the morning), but if the vehicle returns to the depot (in this case one or more of the n depot locations) to pick up additional shipments and leaves the depot again afterwards (meaning the next location is a customer location), I want to take the time for loading and unloading into account.
My question is the following:
Is it possible for Optaplanner to have variable service duration during optimization run time? I would add a checker which check whether before the index of the depot location in the state of the tour there is a customer location planned before this index and add service duration in this case, because this means that a customer stop was already visited and the transporter is returning to the depot (and therefore service time is needed).

I hope I described everything clearly. Thank you for your help!

Yes, you can. If you look into the TSP or VRP example, you'd note that a Depot and Customer are a different type, but they share the same interface. This allows them to be chained together to form a route.

To allow for variable service duration, all you have to do is to check the type of the planning entity and the previous planning entity to see if it is the first depot or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM