home » the workshop » Christmas Packing 2025
Optimization
NEW!Christmas Packing 2025
Kaggle’s Santa 2025 puzzle: pack 1 to 200 Christmas-tree polygons into the smallest possible square. Geometric families, simulated annealing and a GPU optimizer.
- access:
- private
- year:
- 2025
- built with:
- Python, Shapely, PyTorch
Kaggle’s Santa 2025 challenge: for every n from 1 to 200, pack n identical Christmas-tree-shaped polygons into the smallest square you can, with no overlaps. The score adds up each square’s area divided by n, so every single configuration counts.
My attempts included hand-designed geometric families (spirals and diagonal chains of interlocking trees), simulated annealing to jiggle positions and rotations into tighter fits, and a GPU optimizer that rasterizes the trees for fast approximate overlap checks. The final geometry runs on 50-digit decimal precision, because the overlap check has to be exact.
~ highlights ~
- Shapely with an STRtree spatial index for fast overlap checks
- Parallel search across CPU cores
- PyTorch on CUDA for rasterized overlap checks when a GPU is available
This one lives in a private repo. Ask me about it.