Skip to content

Capacity Types

Capacity Types define different units of measure for vehicle capacities and job quantities.


What are Capacity Types?

Capacity Types allow you to define flexible capacity configurations for different logistics scenarios.


Basic Usage

CapacityType Enum

Type Description
weight_kg Weight (kilograms)
weight_ton Weight (tons)
volume_l Volume (liters)
volume_m3 Volume (cubic meters)
length Length
area Area
pallet Number of pallets
unit Unit/piece

Use Cases

1. Weight-Based Capacity (kg)

{
  "vehicles": [
    {
      "id": "truck_1",
      "constraints": {
        "capacity": 5000,
        "capacityType": "weight_kg"
      }
    }
  ],
  "jobs": [
    {
      "id": "job_1",
      "amount": 500,
      "amount_type": "weight_kg"
    }
  ]
}

2. Pallet-Based Capacity

{
  "vehicles": [
    {
      "id": "truck_1",
      "constraints": {
        "capacity": 24,
        "capacityType": "pallet"
      }
    }
  ],
  "jobs": [
    {
      "id": "job_1",
      "amount": 4,
      "amount_type": "pallet"
    }
  ]
}

3. Volume-Based Capacity (m³)

{
  "vehicles": [
    {
      "id": "truck_1",
      "constraints": {
        "capacity": 80,
        "capacityType": "volume_m3"
      }
    }
  ],
  "jobs": [
    {
      "id": "job_1",
      "amount": 10,
      "amount_type": "volume_m3"
    }
  ]
}

4. Tonnage-Based Capacity

{
  "vehicles": [
    {
      "id": "truck_1",
      "constraints": {
        "capacity": 20,
        "capacityType": "weight_ton"
      }
    }
  ],
  "jobs": [
    {
      "id": "job_1",
      "amount": 2,
      "amount_type": "weight_ton"
    }
  ]
}

Configuration

Vehicle Capacity

{
  "vehicles": [
    {
      "id": "vehicle_1",
      "constraints": {
        "capacity": 1000,
        "capacityType": "weight_kg"
      }
    }
  ]
}

Job Amount

{
  "jobs": [
    {
      "id": "job_1",
      "amount": 150,
      "amount_type": "weight_kg"
    }
  ]
}

Matching Rule

The vehicle capacityType and the job amount_type must be the same or convertible.


Python Example

import requests

API_BASE_URL = "https://api.flio.ai"
API_KEY = "YOUR-API-KEY"

payload = {
    "vehicles": [
        {
            "id": "truck_1",
            "start": {"latitude": 41.0082, "longitude": 28.9784},
            "constraints": {
                "capacity": 24,
                "capacityType": "pallet"
            }
        }
    ],
    "jobs": [
        {
            "id": "job_1",
            "start": {"latitude": 41.0100, "longitude": 28.9800},
            "end": {"latitude": 41.0150, "longitude": 28.9850},
            "amount": 4,
            "amount_type": "pallet"
        },
        {
            "id": "job_2",
            "start": {"latitude": 41.0110, "longitude": 28.9810},
            "end": {"latitude": 41.0160, "longitude": 28.9860},
            "amount": 6,
            "amount_type": "pallet"
        }
    ],
    "options": {"minimize": "distance"}
}

url = f"{API_BASE_URL}/solver/optimize?apiKey={API_KEY}"
response = requests.post(url, json=payload)
result = response.json()

Capacity Types — Flio.ai

Next Steps