Vehicle Capacities: JSPRIT dynamically updating through the course of a trip?

Hi there,

I created a solution that allows users to set custom capacities, speeds, start and end times. The solution incorporates time windows, delivery orders, and pick up orders.

My main question is, when the custom speeds and capacities are set, trucks are given more orders compared to their capacities. That got me thinking, if a truck given it’s initial capacity (say 25 units) and then as it drops off deliveries, is JSPRIT calculating new orders it could pick up and deliver while ensuring the capacity is respected?

Example:

total capacity is 25. The truck delivers 7 orders (now the total capacity has 7 free units to use), the truck picks up more orders along to it’s next delivery (5 more orders, so 5 units are used).

Is this how the capacity and route are being accounted? Please let me know if I need to clarify anything.

Cheers!

Hiya,

I have experienced that in the past. Where I had pickups only in 1 location (a depot), the vehicles will head back to the depot and pickup more while passing the depot.
If you didn’t want this you would have to put in a constraint that all deliveries get completed before pickups are made.

If you iterate over the touractivities you may be able to get current vehicle capacity to ensure it isn’t going over but I’m not sure where that info is held. It shouldn’t be going over capacity though.
I’ve never assessed it before, so up to you :slight_smile:

Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
	for (VehicleRoute route : Solutions.bestOf(solutions).getRoutes()) {
            for (TourActivity act : route.getActivities()) {
            }
        }

Awesome, thanks Greg! I thought it was doing something like that, which makes lots of sense. I am going to look into adding some hard constraints as you suggested. :smiley: