Vehicle dependent velocities in Jsprit

Does jsprit support vehicle dependent velocities? For example, say we have a motorbike and a truck - the motorbike can travel at a max velocity of 35 km/h, and the truck can travel at a max velocity of 80. Their differing speeds would affect their travel times and time-dependent costs.

In VehicleRoutingTransportCostMatrix, getTransportCost and getTransportTime take a vehicle as a parameter, but, if I am not mistaken, neither appear to take into account the vehicle’s maximum velocity. Additionally, it looks like we can set maxVelo in VehicleTypeImpl.Builder, but it doesn’t seem to be passed in VehicleCostParams.

Thanks in advance :slight_smile:

You need to implement your own VehicleRoutingTransportCosts. Here you need to differentiate between vehicle types. For example, if you have two travel time matrices motorbikeMatrix and truckMatrix, then you specify in your implementation that motorbikeMatrix should be used if vehicle is of type motorbike.

Let me know if you need further help here.

Hi @stefan,

I’m trying to implement this feature, and I have created a class VehicleDependentTransportCostsMatrix which returns TransportCost, TransportTime, Distance etc. based on vehicle type. But many methods send vehicle parameter as null while calling these function. How do tackle this problem? Should I return some default value when vehicle parameter is null?
If yes what should be that value? (Average of all vehicles?)

Can you please guide me in this.