Multiple serive time; Multiple travel time matrix

Hi, dear all,
Hi, @stefan @jie31best

I have already read all the instance and examples, but still have two questions about the multiple serive time and multiple travel time.

In my case, I have two type of vehicle, e.g., van and bike. And I have distance matrix, travel time matrix which are calculated by using GPS data. It means I get seperate travel matrix for bike and van. The service time of van and bike is also different at each customer location .
Questions: 1. The Service class is only allowed to add single service time for each service object. How can I set different service time for each type of Vehicle?
2. As I have two seperate travel time matrix for both van and bike? How can I solve this HVRP?
As I read in the HVRP example, the only differience of each type vehicle are the capacity and cost, but not travel time. Note that setting different speed for van and bike is not the expected solution for me since the travel time matrix is the data I have to use. I can not calculate them by simply using the distance/speed.

I hope some kind person can help me or give some advices.

Thanks in advance!

  1. You can set a per vehicle type cost weighting for service time with setCostPerServiceTime. You will need to make sure that your costs make sense though.

  2. You can implement VehicleRoutingTransportCosts. Then you’ll be able to return a different cost for each vehicle type.

Hi @TS-routing,

Regarding your first question, similar to @joash’s answer to the second one, there is a VehicleRoutingActivityCosts, in which you can return a different service time for each vehicle type via the getActivityDuration method.

Best regards,