Skip to main content

Fleet Size and Mix optimizer for heterogeneous fleets of multi-compartment vehicles

Project description

🚚 fleetmixDesigning Multi‑Compartment Last‑Mile Vehicle Fleets: An Open‑Source Matheuristic

PyPI CI License: MIT Coverage

Written for transparent research, hardened for production use.

Fast, reproducible tooling for multi‑compartment vehicle fleet design in urban food distribution. This repository supports our paper Designing Multi‑Compartment Last‑Mile Vehicle Fleets: An Open‑Source Matheuristic and provides a production-ready library for practitioners.


✨ Why FleetMix?

  • Scales — >1,000 customers solved in seconds via a cluster‑first → MILP‑second matheuristic
  • 🧩 Extensible — pluggable clustering engines, route‑time estimators, and solver back‑ends
  • 🔄 Reproducible — every experiment in the journal article re‑runs with one script
  • 🖥️ User‑friendly — clean CLI, idiomatic Python API, and a lightweight web GUI
  • 📐 Spec-driven — comprehensive module specifications connecting paper to code

🗺️ Table of Contents

  1. Installation
  2. Quick Start
  3. Running Examples
  4. 📐 Specifications & Documentation
  5. 🔬 Reproducing Paper Experiments
  6. Configuration
  7. Composability & Extensibility
  8. License

⚙️ Installation

From PyPI

uv pip install fleetmix

From Source (development)

# Clone and set up environment
git clone https://github.com/ekohan/fleetmix.git && cd fleetmix

# Install uv (if needed)
curl -LsSf https://astral.sh/uv/install.sh | sh
source "$HOME/.local/bin/env"

# Create virtual environment and install all extras
uv venv fleetmix-env
source fleetmix-env/bin/activate
uv sync --all-extras --active

# Test
fleetmix --help

🚀 Quick Start

Command‑Line Interface

# Run optimization on customer demand data
fleetmix optimize --demand customers.csv --config fleet.yaml

# Reproduce paper results
fleetmix reproduce-paper

# List all available commands
fleetmix --help

Python API

import fleetmix as fm

customers_df = ...  # build a DataFrame
solution = fm.optimize(demand=customers_df, config="config.yaml")

Web Interface

fleetmix gui

The GUI provides drag‑and‑drop CSV upload, interactive parameter tweaking, real‑time optimization progress, and map‑based visual results.


💡 Running Examples

The examples/ directory contains standalone scripts demonstrating various features. We recommend running them using uv run to ensure they use the correct environment:

# Heterogeneous fleet demo
uv run python examples/heterogeneous_fleet.py

# Custom clustering plugin (Round Robin)
uv run python examples/custom_clustering.py

# Custom route-time estimator (Straight Line)
uv run python examples/custom_route_time.py

# Custom solver adapter (Naive CBC)
uv run python examples/custom_solver_adapter.py

Note: If you have already activated your virtual environment (via source fleetmix-env/bin/activate), you can simply use python examples/....


📐 Specifications & Documentation

FleetMix is a spec-driven codebase: each module has detailed specifications connecting the paper's mathematical formulations to the implementation.

For Researchers

Document Purpose
docs/ARCHITECTURE.md System overview and module interactions
docs/mapping.md Complete paper section ↔ code cross-reference
docs/specs/ Detailed module specifications with math formulations
docs/REPRODUCIBILITY.md Reproduce all paper experiments

For Practitioners

Document Purpose
docs/quickstart.md Get started in 5 minutes
docs/USER_GUIDE.md Complete end-to-end workflow guide
docs/specs/configuration.md All parameters explained
docs/specs/protocols.md Plugin development guide

🔬 Reproducing Paper Experiments

All experiments from the paper can be reproduced using the fleetmix reproduce-paper command suite:

# View available experiments
fleetmix reproduce-paper --help

# Experiment 1: MCVRP benchmark instances (Section: Effectiveness of the Matheuristic Approach)
fleetmix reproduce-paper mcvrp-instances

# Experiment 2: Sensitivity analysis (Section: Benefits of using MCVs)
fleetmix reproduce-paper sensitivity-analysis

# Experiment 3: Fleet composition analysis (Section: Impact of Cost Structure on Fleet Composition)
fleetmix reproduce-paper fleet-composition

📖 Full documentation: docs/REPRODUCIBILITY.md


⚙️ Configuration

FleetMix uses YAML configuration files to define fleet composition, optimization parameters, and operational constraints:

vehicles:
  SmallVan:
    capacity: 1800
    fixed_cost: 80
    compartments: 2
  LargeTruck:
    capacity: 4500
    fixed_cost: 200
    compartments: 3
    allowed_goods: ["Dry", "Chilled"]  # Optional: restrict goods types

goods: [Dry, Chilled, Frozen]

📖 Full reference: docs/specs/configuration.md · default_config.yaml


🧩 Composability & Extensibility

FleetMix uses a Protocol-based plugin architecture (see src/fleetmix/interfaces.py) that makes it easy to add custom implementations for core components.

The plugin system supports:

  • Clustering algorithms: K-means, K-medoids, Agglomerative, Gaussian Mixture, or your own
  • Route time estimators: BHH, TSP-based, or custom (e.g., with traffic data)
  • Solvers: Gurobi, CBC, or any PuLP-compatible solver

See also:


🪪 License

MIT — free for academic & commercial use. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fleetmix-1.1.0.tar.gz (124.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fleetmix-1.1.0-py3-none-any.whl (147.4 kB view details)

Uploaded Python 3

File details

Details for the file fleetmix-1.1.0.tar.gz.

File metadata

  • Download URL: fleetmix-1.1.0.tar.gz
  • Upload date:
  • Size: 124.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fleetmix-1.1.0.tar.gz
Algorithm Hash digest
SHA256 965177c9779712a2bef1896740d85c1f71c86b509a84f55b7111c3e064d3df26
MD5 284517a273d8a874652b9c19c30d1157
BLAKE2b-256 fa5bc55b99c9e258f85e2f6d8d1bfbbae08c50fea49852a36b839c0570adbba1

See more details on using hashes here.

File details

Details for the file fleetmix-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: fleetmix-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 147.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fleetmix-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 520ef0fb64d462c4e4f836f7627a08561191a97b6dedc787d2944434de14bff7
MD5 05ad9bd94a992e871db45db0f60bed60
BLAKE2b-256 f6795aed39de88ff97c489e2096e435e4fbb16808d54f60e27c7d1d2454523ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page