jsprit icon indicating copy to clipboard operation
jsprit copied to clipboard

VRP with Custom Distances

Open davidliang104 opened this issue 1 year ago • 1 comments

Hello!

I would like to use Jsprit for solving a Vehicle Routing Problem (VRP) that involves pickups and deliveries. Is it possible to incorporate custom distances into the model, perhaps with a distance matrix, for specifying distances between vehicles and services, as well as between different services?

Thanks

davidliang104 avatar Jun 06 '24 17:06 davidliang104

com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.Builder#setRoutingCost(new AbstractForwardVehicleRoutingTransportCosts() {

            @Override
            public double getTransportCost(Location from, Location to, double departureTime, Driver driver, Vehicle vehicle) {
                // TODO return cost base on transportTime and distance
                return 0;
            }

            @Override
            public double getTransportTime(Location from, Location to, double departureTime, Driver driver, Vehicle vehicle) {
                // TODO return transportTime
                return 0;
            }

            @Override
            public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
                // TODO return distance
                return 0;
            }
        })

ng-life avatar Mar 14 '25 12:03 ng-life