Skip to content

Pickups and deliveries (PDPTW)

~4 min · Recipe

A pickup-and-delivery job carries a load from one place to another on the same vehicle: the pickup must come before the delivery, and both are on one route. This is the classic PDPTW (pickup-and-delivery problem with time windows).

Define both a pickups task and a deliveries task on the same job:

{
  "id": 201,
  "pickups": [{
    "id": 2001,
    "location": [49.28270, -123.11540],
    "duration": 180,
    "demand": [3],
    "serviceWindows": [{ "start": "2026-07-31T08:00:00-07:00", "end": "2026-07-31T10:00:00-07:00" }]
  }],
  "deliveries": [{
    "id": 2002,
    "location": [49.24660, -123.06340],
    "duration": 300,
    "demand": [3],
    "serviceWindows": [{ "start": "2026-07-31T10:00:00-07:00", "end": "2026-07-31T13:00:00-07:00" }]
  }]
}
  • The engine guarantees pickup before delivery, both on the same vehicle.
  • Capacity is consumed between the two stops — the demand should match on both sides.
  • The anchor (which side drives sequencing) is the task that carries the service window; give the window to the constrained end.

One-to-one

A job supports pickup-only, delivery-only, or one pickup and one delivery. It does not support multiple pickups and multiple deliveries in a single job — model those as separate jobs.

Related: Capacities and demand · Time windows · Re-optimization