Grouping pickups/deliveries

Hi all!
I started using JSprit very recently, although I’m a bit familiar with the Route Optimization API. And, for a new project, I’m trying to replicate some of its behavior (since I can’t use the paid API for it).

Context
The service I created runs as a DropWizard application, and I’m using a VehicleRoutingTransportCosts that gets the distances and times from an embedded GraphHopper with OSM maps. Other than that, I’m using all the defaults. Nothing out of the ordinary.

The problem
I have to optimize a few shipments, let’s say P-S (pickup-delivery), P-S, P-S, S-P, starting in P and finishing wherever the optimizer decides is best. Capacities and sizes are fine (ie, the vehicle has more capacity than the combined sizes of the shipments).

When I run the optimization, I get

  1. Start in S
  2. Pickup in in P
  3. Delivery in S
  4. Pickup in in P
  5. Delivery in S
  6. Pickup in S
  7. Delivery in P
  8. Pickup in P
  9. Delivery in S
  10. End in S

(that’s 6 trips)

Instead of a more reasonable

  1. Start in S
  2. Pickup n S
  3. Pickup in P
  4. Pickup in P
  5. Pickup in P
  6. Delivery in P
  7. Delivery in S
  8. Delivery in S
  9. Delivery in S
  10. End in S

(that’s 2 trips, which I got from GraphHopper-aaS, using the minimize completion time objective)
My result is clearly wasteful.

My question would then be, what am I missing that is preventing my solution to be “better”, like the one from GHaaS?

Ok, so… I found the problem…
I was using the “truck” profile, but it’s not supported, it didn’t have all the distances to compute a proper route.
Which brings me to my next question… On a new topic.
Thanks for reading!