# Do we need Distance Matrix? Isn't time Matrix sufficient? (not programatically but logically)

Do we need Distance Matrix? Isn’t time Matrix sufficient? (not programatically but logically)
Why do we need DistanceMatrix ?

Also, once Jsprit has found initial solution, does it use time Matrix any where or call getCosts method from SolutionCostCalculator which internally uses some method to call time Matrix.

In other words, as iteration progresses, does optimization rely only on SolutionCostCalculator and does not call methods of VehicleRoutingTransportCosts anywhere?

As for the exact working of the cost calculator, I wouldn’t by able to give an exact answer. But both matrices contribute to evaluating the cost of a solution throughout.

For a problem of Cartesian coordinates and assuming a fixed speed, sure, one matrix is enough.

For real-road distances and times, the two do not correlate very well. Time cost matrix is important for predicting arrival times for the customer, but also includes the cost of the salary for the driver, which might also change based on the equipment the vehicle is carrying. Distance costs rely on the fuel consumption of that vehicle. It’s not reasonable at that point to bundle it into a single cost, because road speeds can vary dramatically.

1 Like