GraphHopper.com | Forum | GitHub | Maps | Blog

Deliver multiple times to one location


#1

Hi Jsprit community,

First of all, thank you for producing this amazing library.

I will try to describe the problem as easy as possible.

I use an MatrixBuilder.

I have 1 delivery address (Delivery(or Service)). This delivery has a instance of “delivery1” and has a size dimension of 3000.
This is because I want to delivery 3000(kg) of an item.
The delivery needs to be done on the location with id 1.

I made it like this:

Delivery delivery1 = Delivery.Builder.newInstance("delivery1")
.addSizeDimension(0, 3000)     
.setLocation(Location.newInstance("1"))
.build();

Then i made the truck and truck type.
The trucks have a capacity of 1000(kg) and start at location 0(which represents the depot)

VehicleType type = VehicleTypeImpl.Builder.newInstance("type").addCapacityDimension(0,
                                                                                    1000).build();
List<VehicleImpl> vehicleList;

vehicleList = new ArrayList<>();

VehicleImpl vehicle1 = VehicleImpl.Builder.newInstance("vehicle1").setStartLocation(Location.newInstance("0"))
    .setType(type).build();
VehicleImpl vehicle2 = VehicleImpl.Builder.newInstance("vehicle2").setStartLocation(Location.newInstance("0"))
    .setType(type).build();
VehicleImpl vehicle3 = VehicleImpl.Builder.newInstance("vehicle3").setStartLocation(Location.newInstance("0"))
    .setType(type).build();

vehicleList.add(vehicle1);
vehicleList.add(vehicle2);
vehicleList.add(vehicle3);

Finally i add the delivery and all the vehicles. To the problem

VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().setFleetSize(FleetSize.FINITE)
        .setRoutingCost(costMatrix).addAllVehicles(vehicleList).addJob(delivery1).build();

There are 3 expected results

  1. All the vehicles(vehicle1, vehicle2 and vehicle3) will drive to the delivery location so 3000(kg) is delivered.
  2. Or one truck will drive 3 trips
  3. Or one truck will drive 2 trips and another will drive 1 so still the delivery is fully done.

The trucks also need to go back to depot when finished.

The result i get back is the following:

+--------------------------+
| problem                  |
+---------------+----------+
| indicator     | value    |
+---------------+----------+
| noJobs        | 1        | 
| noServices    | 1        | 
| noShipments   | 0        | 
| noBreaks      | 0        | 
| fleetsize     | FINITE   | 
+--------------------------+
+----------------------------------------------------------+
| solution                                                 |
+---------------+------------------------------------------+
| indicator     | value                                    |
+---------------+------------------------------------------+
| costs         | 0.0                                      | 
| noVehicles    | 0                                        | 
| unassgndJobs  | 1                                        | 
+----------------------------------------------------------+
+--------------------------------------------------------------------------------------------------------------------------------+
| detailed solution                                                                                                              |
+---------+----------------------+-----------------------+-----------------+-----------------+-----------------+-----------------+
| route   | vehicle              | activity              | job             | arrTime         | endTime         | costs           |
+--------------------------------------------------------------------------------------------------------------------------------+
+----------------+
| unassignedJobs |
+----------------+
| 1              |
+----------------+

Is there any way my problem can be descriped with jsprit.

Kind regards,

Dragster1406


#2

I’m very rusty on jsprit these days but it would seem that you have a different kind of constraint violation. Are you using time windows too?


#3

Hi roganjosh,

Thanks for answering.

No in this problem i are not using the time window constraint or any other constraints. The only other constraint is the finite fleet. Could this be the problem?

Kind regards,

Dragster1406


#4

Gonna take some stabs in the dark here:

  1. You have a mistmatch of unit sizes. Check everything is in kg.

  2. You have a mismatch in travel times and time windows. Check they’re consistent.

I can’t see anything obvious otherwise, but these would easily explain your problem.


#5

Hi roganjosh,

Thanks again for responding to me. I choose for the example to not use any timewindows. So it couldn’t be that problem. And as u can see the size dimension is 3000 for the delivery and 1000 for the truck.

So unfortunately it isn’t that easy of a problem. I can solve this by deviding the delivery in even pieces so the truck can carry it, but this isn’t such a nice problem solver.

I hope you still got some ideas.

Kind regards,

Dragster1406