A distributed 2D geometric packing solver, verification pipeline, and benchmark tracker.
- Web Dashboard and Browser Worker: https://targed.github.io/shape-packing/
- Live Coordinator API:
https://shape-packing-ggd4d5e8c2ctggam.eastus-01.azurewebsites.net - Issue Tracker and Contributing Guide: CONTRIBUTING.md
- Join the Community: Discord
The project searches for tighter packings of congruent polygons, circles, polyforms, and curved containers, verifies every candidate in-process with Separating Axis Theorem (SAT) collision and containment checks, and tracks progress alongside published bounds from Erich Friedman's Packing Center, Packomania, independent researchers, and open frontier families.
You do not need to clone this repository, install Python, or compile Rust to contribute:
- Submit External Packings (
/submit): Already computed or maintained packings externally? Paste JSON, CSV, or plain coordinate tables on the Submit page to preview, verify, and archive them with attribution. - In-Browser WebAssembly Worker: Open the Contribute page, enter a username, select thread count, and start crunching directly in your browser.
- Standalone Desktop Worker (
shape-packing-worker): Download the prebuilt archive for your platform from GitHub Releases:- Windows (x86_64):
shape-packing-worker-windows-x86_64.zip - Windows (ARM64):
shape-packing-worker-windows-arm64.zip - Linux (x86_64):
shape-packing-worker-linux-x86_64.tar.gz - Linux (ARM64):
shape-packing-worker-linux-arm64.tar.gz - macOS (Universal):
shape-packing-worker-macos-universal.tar.gz
- Windows (x86_64):
Extract and run the binary. On first launch, a setup wizard asks for the coordinator URL, your username, and CPU thread count, then saves credentials (worker_id and worker_secret) to ~/.shape_packing_worker.json. To run on login without administrator privileges:
shape-packing-worker autostart enableAll shapes, aliases, enabled pair rules, and N bounds are declared in src/shape_packing/shape_catalog.json and loaded by src/shape_packing/catalog.py:
- Benchmark Shapes: Regular polygons (
3through10sides),CIRCLE,TAN,DOMINO,L, plus curved circle containers (SEMICIRCLE,QUADRANT) seeded fromdata/packingVerification/*.jsonand extended toN=1..100. - Frontier Shapes: Canonical convex quadrilaterals (
RHOMBUS,PARALLELOGRAM,TRAPEZOID) paired with{3, 4, 5, 6, 7, 8, CIRCLE}and each other acrossN=1..100. - Universal Problem Selector: Edit
problem_ranges.default_max_n,problem_ranges.pair_max_n,pair_rules.disabled_pairs, orpair_rules.disabled_problemsinsrc/shape_packing/shape_catalog.jsonto adjust what the coordinator seeds and serves without editing Python code.
- Python 3.10 or higher
- Rust toolchain 1.75 or higher (
cargo,rustc) - Node.js 20 or higher (only needed if building
site/)
git clone https://github.com/targed/shape-packing.git
cd shape-packing
python -m venv .venv
# Linux/macOS: source .venv/bin/activate
# Windows (PowerShell): .venv\Scripts\Activate.ps1
pip install -r requirements.txt
cargo build --release --manifest-path packer_rs/Cargo.tomlTo build the standalone volunteer binary:
cargo build --release --bin shape-packing-worker --no-default-features --manifest-path packer_rs/Cargo.toml# Suggest a high-priority target problem
python -m src.shape_packing.cli suggest
# Solve a specific problem locally
python -m src.shape_packing.cli run --problem 5_TAN_in_4 --attempts 5000
# Start a local coordinator server
python -m uvicorn src.shape_packing.server.app:app --host 0.0.0.0 --port 8000
# Run the Python worker daemon or tray GUI against a coordinator
python -m src.shape_packing.client.native_worker --server http://localhost:8000 --username your_name --cores 4
python -m src.shape_packing.client.gui
# Rebuild static site data and verify the Astro frontend
python scripts/build_site_data.py
npm test --prefix site
npm run build --prefix sitepytest tests/test_security_api.py tests/test_package_imports.py tests/test_server_database.py tests/test_server_scheduler.py tests/test_solution_tools.py tests/test_native_worker.py tests/test_client_controller.py tests/test_client_gui.py tests/test_client_autostart.py tests/test_client_tray.py
cargo test --manifest-path packer_rs/Cargo.toml
npm test --prefix siteshape-packing/
├── .github/ # Workflows, issue forms, and PR template
├── data/
│ ├── packingVerification/ # Reference benchmark JSON datasets
│ ├── records/ # Verified candidate solution packages
│ └── priority_queue.json # Priority queue for local search
├── docs/ # Technical guides, security docs, and specs
├── packer_rs/ # Rust solver (SAT + L-BFGS/Adam), PyO3, WASM, and worker binary
├── scripts/ # Importers, exporters, and site data builders
├── site/ # Astro web dashboard and browser WASM worker
├── src/shape_packing/ # Python package (catalog, verifier, CLI, coordinator, client)
└── tests/ # Python test suite
- System Architecture
- Shape Geometry and SAT Math
- Benchmarks and Ranking
- HPC and Slurm Execution
- Debugging, Testing, and Verification
- CLI Reference
- Distributed Coordinator and Worker Guide
- Threat Model
Using this project and its hosted server is completely free. Running and maintaining the server does come with ongoing hosting costs. If you find it useful and want to help keep it running or fund future upgrades, you can support it via GitHub Sponsors. Donations are always appreciated, never required!