0

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)

akiortagem
  • 135
  • 3
  • 16

1 Answers1

2

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.

roganjosh
  • 12,594
  • 4
  • 29
  • 46
  • I did supply a dummy data. I implemented a VehicleRoutingTransportCosts class that returns an arbitrarily large number for those pairs so the algorithm won't consider those pairs in the calculation. I'm relieved that someone suggested this, my colleague has been saying that this is an ugly hack. Thanks for the confirmation @roganjosh! As for the graphopper routing machine. I did host my own graphopper instance. Problem is : I need traffic data integration, so I'm able to get the traffic data for my country, I'm sticking with google. – akiortagem Oct 05 '16 at 04:31
  • 1
    @akiortagem for the sake of dummy data, you could use great circle distance, double it and assume a constant speed for time. That way, if you happen to make a mistake over what could be important and what isn't, you don't preclude yourself from a reasonable solution entirely. A mistake with arbitrarily large data would result in forcing a particular solution if it ever did get thrown into the mix. At least for a few runs as a sanity check. – roganjosh Oct 05 '16 at 04:55