Diffrence between addTransportTime and addTransportDistance in the cost matrix

I’m new in jsprit.
I have pickup\delivery problem.
I don’t understand why the solution is different in case when I fill VehicleRoutingTransportCostsMatrix with addTransportDistance or addTransportTime functions.
The solution is more accurate when I use to addTransportDistance function

Cost matrix
image

In the VehicleTypeImpl class, you can find the following:

    /**
     * default cost values for default vehicle type
     */
    private double fixedCost = 0.0;
    private double perDistance = 1.0;
    private double perTime = 0.0;
    private double perWaitingTime = 0.0;
    private double perServiceTime = 0.0;

Thus, when you do not set time cost for the vehicle type, and in the cost matrix you add time only and no distance, your route will always get 0 cost and will not be as expected (or as you said, not as accurate).

1 Like

When I’ve added the cost per time it’s works as expected. Thanks a lot.