Skip to main content

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

Project description

🚚 fleetmixFleet Size & Mix Optimizer for Multi‑Compartment Fleets

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 forthcoming paper Designing Multi‑Compartment Vehicle Fleets for Last‑Mile Food Distribution Systems and doubles as a production‑grade library for industry users.


Fleetmix demo animation
(interactive demo – coming soon)


✨ 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.

🗺️ Table of Contents

  1. Installation
  2. Quick Start
  3. Architecture Overview
  4. Command‑Line Usage
  5. Python API
  6. Benchmarking Suite
  7. Repository Layout
  8. Paper ↔ Code Map
  9. Contributing
  10. Citation
  11. License

⚙️ Installation

From PyPI (coming soon)

pip install fleetmix

From Source (development)

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

# Install in editable mode
pip install -e .

🚀 Quick Start

Command‑Line Interface

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

# Run the full MCVRP benchmark suite
fleetmix benchmark mcvrp

# Convert VRP instance to FSM format
fleetmix convert --type cvrp --instance X-n101-k25 --benchmark-type split

# Check version
fleetmix version

Python API

import fleetmix

solution = fleetmix.optimize(
    demand="customers.csv",
    config="fleet_config.yaml"
)

print(f"Total cost: ${solution['total_cost']:,.2f}")
print(f"Vehicles used: {len(solution['vehicles_used'])}")

Web Interface

# Launch web interface
fleetmix gui

# Or specify a custom port
fleetmix gui --port 8080

The GUI provides:

  • 📥 Drag‑and‑drop CSV upload
  • 🎛️ Interactive parameter tweaking
  • 🔎 Real‑time optimization progress
  • 🗺️ Map‑based visual results
  • 📊 Excel/JSON export

🏗️ Architecture Overview

graph LR
    A[Read Demand] --> B[Generate feasible clusters]
    B --> C[MILP fleet‑selection]
    C --> D[Merge improvement phase]
    D --> E["Results (JSON | XLSX | HTML)"]

Full algorithmic details are in §4 of the paper.


🔧 Command‑Line Usage

fleetmix optimize

Run fleet optimization on customer demand data.

fleetmix optimize \
  --demand customers.csv \
  --config fleet.yaml \
  --output results/ \
  --format excel \
  --verbose

fleetmix benchmark

Run the full benchmark suites shipped with Fleetmix (batch mode over all instances).

fleetmix benchmark mcvrp   # All MCVRP instances
fleetmix benchmark cvrp    # All CVRP instances

fleetmix convert

Convert a single CVRP / MCVRP instance into FSM format, run optimisation, and export results.

fleetmix convert --type mcvrp --instance 10_3_3_3_\(01\)

Legacy direct‑script calls still work but show deprecation warnings.


🐍 Python API

import fleetmix as fm

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

Retrieve metrics via solution[...] keys (see docstring for full schema).


📊 Benchmarking Suite

Located under src/fleetmix/benchmarking/.

  • Converters.vrp / .dat → FSM tables
  • Parsers & Models – light dataclasses for CVRP / MCVRP metadata
  • Solvers – PyVRP wrapper providing single‑ & multi‑compartment baselines
  • Scripts – batch runners producing JSON/XLSX artifacts in results/

Upper‑ and lower‑bound reference solutions are generated automatically for sanity checks.


🗂️ Repository Layout

src/fleetmix/
  api.py                # Python API facade
  app.py                # CLI (Typer)
  clustering/           # capacity & time‑feasible cluster generation
  optimization/         # MILP core (PuLP/Gurobi)
  post_optimization/    # merge‑phase heuristic
  benchmarking/         # datasets • converters • baselines
  gui.py                # lightweight web GUI
  utils/                # I/O, logging, etc.
docs/                   # code↔paper map • design notes

📝 Paper ↔ Code Map

See docs/mapping.md for a line‑by‑line crosswalk between paper sections and implementation.


🤝 Contributing

  1. Fork → feature branch → PR against main.
  2. pytest -q --cov=src must stay green.
  3. Follow PEP‑8, add type hints, and keep public APIs doc‑commented.

Bug reports and ideas via Issues are welcome.


📚 Citation

@article{Kohan2025FleetMix,
  author  = {Eric Kohan},
  title   = {Designing Multi‑Compartment Vehicle Fleets for Last‑Mile Food Distribution Systems},
  journal = {To appear},
  year    = {2025}
}

🪪 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-0.1.0b1.tar.gz (83.5 kB view details)

Uploaded Source

Built Distribution

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

fleetmix-0.1.0b1-py3-none-any.whl (97.0 kB view details)

Uploaded Python 3

File details

Details for the file fleetmix-0.1.0b1.tar.gz.

File metadata

  • Download URL: fleetmix-0.1.0b1.tar.gz
  • Upload date:
  • Size: 83.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fleetmix-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 e657b59f5d469858ee7822f9c51550553c995e13003ba9d8fb1f2431425c4422
MD5 959c38abbb697e2e8f4ff6e5bfe9e476
BLAKE2b-256 a5e0b18b82c85d9077ba12957b0392c468cee08c5a13412405295eb9f738effd

See more details on using hashes here.

File details

Details for the file fleetmix-0.1.0b1-py3-none-any.whl.

File metadata

  • Download URL: fleetmix-0.1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 97.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fleetmix-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 0bd43703764bccfc73e5407c5ef230552ea21514556df19b0cbc5e0385be9bbf
MD5 c838867bc407e5a0d0fbad12ff82470c
BLAKE2b-256 2bc50848336bf6a16d7ce81e26f58b71fe6a5b83ec56060965289045ef9a9995

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