Skip to main content

Last Mile Delivery

Fleet routing with time windows, capacity, breaks, and special requirements.

Request

{
  "resources": [
    {
      "name": "van-001",
      "shifts": [{
        "from": "2024-03-15T08:00:00",
        "to": "2024-03-15T16:00:00",
        "start": {"latitude": 40.7484, "longitude": -73.9857},
        "end": {"latitude": 40.7484, "longitude": -73.9857},
        "breaks": [{
          "type": "FIXED",
          "from": "2024-03-15T12:00:00",
          "to": "2024-03-15T12:30:00",
          "duration": 1800
        }]
      }],
      "capacity": [150, 2000],
      "tags": ["refrigerated"]
    }
  ],
  "jobs": [
    {
      "name": "order-001-premium",
      "location": {"latitude": 40.7580, "longitude": -73.9855},
      "duration": 300,
      "load": [1, 2],
      "priority": 100,
      "windows": [{
        "from": "2024-03-15T09:00:00",
        "to": "2024-03-15T11:00:00",
        "hard": true
      }]
    },
    {
      "name": "order-002-cold",
      "location": {"latitude": 40.7282, "longitude": -73.9942},
      "duration": 300,
      "load": [3, 8],
      "windows": [{
        "from": "2024-03-15T10:00:00",
        "to": "2024-03-15T14:00:00",
        "hard": true
      }],
      "tags": [{"name": "refrigerated", "hard": true}]
    }
  ],
  "options": {
    "traffic": 1.2,
    "routingEngine": "OSM"
  }
}

Response

{
  "score": {"hardScore": 0, "softScore": -15420, "feasible": true},
  "trips": [{
    "resource": "van-001",
    "visits": [
      {"arrival": "2024-03-15T09:10:00", "job": "order-001-premium"},
      {"arrival": "2024-03-15T10:15:00", "job": "order-002-cold"}
    ],
    "travelTime": 4200,
    "serviceTime": 600
  }],
  "unserved": []
}

Key Features

FeatureUsage
capacity: [150, 2000]Multi-dimensional (count, weight)
windows.hard: trueMust arrive within window
tags.hard: trueRequires matching resource tag
breaksFixed or windowed driver breaks
traffic: 1.220% traffic multiplier