Fleet Size and Mix optimizer for heterogeneous fleets of multi-compartment vehicles
Project description
🚚 fleetmix — Designing Multi‑Compartment Last‑Mile Vehicle Fleets: An Open‑Source Matheuristic
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
- Installation
- Quick Start
- Running Examples
- 📐 Specifications & Documentation ⭐
- 🔬 Reproducing Paper Experiments ⭐
- Configuration
- Composability & Extensibility
- Citation
- 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:
- docs/specs/protocols.md for detailed interface definitions
src/fleetmix_example_plugins/for working examples (round_robin.py,straight_line.py,naive_solver.py)
📚 Citation
If using FleetMix in your research:
@article{Kohan2025FleetMix,
author = {Eric Kohan and Fabricio Torres and Victor Silva-Febre and J.C. Pina-Pardo},
title = {Designing Multi-Compartment Last-Mile Vehicle Fleets: An Open-Source Matheuristic},
journal = {TBD},
year = {2025},
note = {To be submitted}
}
Repository: github.com/ekohan/fleetmix
🪪 License
MIT — free for academic & commercial use. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fleetmix-1.0.0.tar.gz.
File metadata
- Download URL: fleetmix-1.0.0.tar.gz
- Upload date:
- Size: 119.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b46c2eef5c53057e9fcabb094f66cf0ad55d112b50868f3fec13744b3400be5
|
|
| MD5 |
820081a7476d8b4ee24cd2cf3fefcbf8
|
|
| BLAKE2b-256 |
d21d7f9e6b1be3591b0c4c5518ecbcc6ee2939c4286970423ce1624b90e28aa1
|
File details
Details for the file fleetmix-1.0.0-py3-none-any.whl.
File metadata
- Download URL: fleetmix-1.0.0-py3-none-any.whl
- Upload date:
- Size: 139.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa7a13f6b85dd3e210a3d95d35ccd314dc6ec0231b14985115cef62a60a6840c
|
|
| MD5 |
2e2eabcf1fa200825d4d32a531c541b4
|
|
| BLAKE2b-256 |
e2fbd6ea14fc7765f531c533ccdc0586151dcb0fab8dad86d6f7351d5adfb969
|