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
- All the vehicles(vehicle1, vehicle2 and vehicle3) will drive to the delivery location so 3000(kg) is delivered.
- Or one truck will drive 3 trips
- 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