Documentation menu
Example
Optimise a mixed fleet
Two lorries, two drops, one of them dangerous goods, and only one vehicle is ADR licensed. The ADR profile constrains the roads; skills constrain the assignment, so the hazmat job can only land on the licensed lorry.
bash
export BASE=https://api.mapmap.ai
export API_KEY=snk_...
curl -fsS -X POST "$BASE/optimise" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"costing": "truck",
"adr": {
"dimensions": { "height_m": 4.0, "width_m": 2.55,
"length_m": 16.5, "gross_weight_t": 40.0 },
"tunnel_code": "C",
"hazmat": true
},
"vehicles": [
{ "id": 1,
"start": { "lat": 51.5074, "lon": -0.1278 },
"end": { "lat": 51.5074, "lon": -0.1278 },
"capacity": [12], "skills": [1], "time_window": [28800, 64800] },
{ "id": 2,
"start": { "lat": 51.5074, "lon": -0.1278 },
"end": { "lat": 51.5074, "lon": -0.1278 },
"capacity": [12], "time_window": [28800, 64800] }
],
"jobs": [
{ "id": 10, "location": { "lat": 51.4545, "lon": -2.5879 },
"service_s": 900, "delivery": [4], "skills": [1] },
{ "id": 11, "location": { "lat": 51.7520, "lon": -1.2577 },
"service_s": 300, "delivery": [3] }
],
"eu_drivers_hours": true
}'
# Job 10 comes back on vehicle 1 and never anywhere else. Times are plain
# seconds on whatever epoch you chose: 28800 is 08:00, 64800 is 18:00.
# eu_drivers_hours generates a compliant break for any vehicle that has a
# time_window and no explicit breaks array.