jsprit

Unnecessary Transport Distance/Time query to VehicleRoutingTransportCosts


I'm new to using jsprit and VRP. I'm setting up a problem where a vehicle needs to to several shipment pickup point and then deliver the goods to several shipment delivery point. I used non-symmetric cost matrix in this case. What I don't understand is why jsprit still asks unnecessary Location pairs from the cost matrix. Example of such query is the transport time/distance from a shipment delivery point to vehicle start point (I also set up the vehicle not to return to depot). Why does this happen? I ask this because querying distance matrix to Google API is expensive and limited to 2500 entries per day (for development mode)


Solution

  • It's an interesting question but I don't think it's a worthwhile optimisation.

    1) Jsprit is partnered with graphhopper that already gives you the ability to self-host your own server that gives distances and times between locations without restriction. You can start here for that, for example, or here.

    2) If you know that the distance/time is irrelevant to your calculation, there's no need to calculate anything at all. Just supply dummy data. It won't be used in the case of a shipment delivery --> warehouse when you set the algorithm not to return to warehouse, so don't bother calculating it.

    You could always raise on github as a suggested feature but my suggestion is definitely to pad with dummy data if you're sure it's irrelevant simply to satisfy the system and not try calculate Euclidean distance.

    As to why this happens, I couldn't be 100% sure but I imagine it's easier to expect all data (a complete matrix) rather than have the overhead of parsing what is/is not important. The fact that it deliberately attempts to fill in gaps with a Euclidean distance even when you supply an almost-complete custom matrix would suggest this is the case. Even a problem with 10,000 shipments and setReturnToDepot(false) you'd only confidently remove 10,000 datapoints from a 100mil matrix.