PDPTW solver package backed by Rust implementation.
Project description
PDP-LNS
A Rust solver for the Pickup and Delivery Problem with Time Windows (PDPTW), focused on Li & Lim benchmark instances.
The project combines Large Neighborhood Search (LNS), Guided Ejection Search (GES), and local improvement operators to build high-quality feasible routes under time and capacity constraints.
Features
- Fast CLI solver for PDPTW instances
- Hybrid search pipeline with multiple neighborhood operators
- Benchmark automation script with optional BKS download and comparison
- Built-in feasibility checks and route-level reporting
Project Layout
src/: solver implementation (instance parsing, neighborhoods, local search, LNS/GES orchestration)instances/: benchmark instance files and best-known solutions tablessrc/bin/benchmark_lilim.rs: batch benchmark runner and summary generatorbenchmark_results/: optional local benchmark outputs (generated, not versioned)
Requirements
- Rust toolchain (stable, Rust 1.87+)
- Python 3.9+ (only for Python bindings)
Quick Start
Build release binary:
cargo build --release
Run solver:
target/release/pdp_lns instances/lrc101.txt 300 42
Arguments:
instance_file: path to Li & Lim instancetime_limit_secs: optional time limit in seconds (default:300)seed: optional RNG seed (default:42)initial_method: optional initial solution method:legacy(old behavior),lu2006(Lu&Dessouky 2006),ropke2006(Ropke&Pisinger 2006 sequential insertion),cluster2004(cluster-paper embedded insertion), orhosny2012(2012 PBQ best-request constructor), defaultlegacy
Example with Lu&Dessouky initial construction:
target/release/pdp_lns instances/lrc101.txt 300 42 lu2006
Runtime flags (environment variables):
BNB_REPAIR_ENABLE=0|1: disable/enable branch-and-bound repair inside LNS (default: enabled).
Python Package
Install locally:
pip install -e .
Use with raw data (without instance files):
import pdp_lns
result = pdp_lns.solve_data(
num_vehicles=2,
capacity=10,
demand=[0, 4, -4],
early=[0.0, 0.0, 0.0],
late=[1000.0, 1000.0, 1000.0],
service=[0.0, 0.0, 0.0],
pair_delivery=[0, 2, 0],
dist_matrix=[
[0.0, 1.0, 2.0],
[1.0, 0.0, 1.0],
[2.0, 1.0, 0.0],
],
# optional coordinates for CLP term in Lu&Dessouky construction
coords=[(0.0, 0.0), (1.0, 0.0), (2.0, 0.0)],
# optional warm start (routes must be depot-bookended and feasible)
initial_routes=[[0, 1, 2, 0]],
# optional switch between initial builders: "legacy" | "lu2006"
initial_method="legacy",
time_limit_secs=30,
seed=42,
)
print(result.vehicles, result.distance, result.feasible)
Benchmarking
Run a benchmark group in parallel:
cargo run --release --bin benchmark_lilim -- --groups LRC2 --time-limit 60 --jobs 8
Examples:
# Run all discovered instances
cargo run --release --bin benchmark_lilim -- --groups ALL
# Run selected instances only
cargo run --release --bin benchmark_lilim -- --instances lrc101 LR1_4_1
# Fixed seed for all jobs
cargo run --release --bin benchmark_lilim -- --groups ALL_BKS --seed-mode fixed
# Use Lu&Dessouky 2006 initial construction
cargo run --release --bin benchmark_lilim -- --groups LR1 --initial-method lu2006
Development
Useful local checks:
cargo fmt --all
cargo check --all-targets
cargo clippy --all-targets -- -D warnings
cargo test
Release workflow checklist: see PUBLISHING.md.
Reproducibility Notes
- Results depend on time limit, machine, and seed.
- Benchmark script supports fixed seeds and offset seeds for parallel runs.
- The repository contains generated benchmark artifacts; refresh them when reporting new results.
License
This project is released under the MIT License. See LICENSE.
Community
- Contribution guide:
CONTRIBUTING.md - Code of conduct:
CODE_OF_CONDUCT.md - Security reporting:
SECURITY.md - Citation metadata:
CITATION.cff
Acknowledgments
- Li & Lim PDPTW benchmark instances
- SINTEF TOP PDPTW benchmark pages and best-known solutions
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 pdp_lns-0.1.1.tar.gz.
File metadata
- Download URL: pdp_lns-0.1.1.tar.gz
- Upload date:
- Size: 173.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bad863ab2b4da618b3e58890772f91c93f1e3272fbf7691d5639030e7159e0a
|
|
| MD5 |
f7d32b55d4b8f9c8f8358ff8eea7801f
|
|
| BLAKE2b-256 |
dd69d4abd5315e4ee95fae8434bbb6c8b275d190b5c2e0644c706673e5af2dc0
|
File details
Details for the file pdp_lns-0.1.1-cp311-cp311-macosx_15_0_arm64.whl.
File metadata
- Download URL: pdp_lns-0.1.1-cp311-cp311-macosx_15_0_arm64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.11, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05e350194a9a3ed04aa6b909f2d9ccc2c37ea4759e633f7dcb4b9dd7ebeb5bf7
|
|
| MD5 |
e510062e23e9c5a3d183b64c011ad5cd
|
|
| BLAKE2b-256 |
2b04357be1329907d5ee9cd2f83717b030beeec9f959c93cf23a68768a8a3d47
|