Overview
The client needed to split a large address list into delivery route files where no two addresses could be within 2,100 meters of each other, a geospatial bin-packing problem at scale.
Problem
- 7,851 addresses across 15 US markets
- 190 output CSV files, max 40 addresses each
- Minimum 2,100m linear distance between any two addresses in the same file
- Prioritize market-specific files before mixing markets
- Named sequentially: AUSTIN #1, AUSTIN #2, ..., MIXED #1
Solution
- Haversine formula for accurate linear distance calculations between coordinates
- Greedy bin-packing algorithm: fills each file with addresses that satisfy the distance constraint
- Market priority sorting ensures market-specific files are maximized before MIXED files are created
- Final output: 190 structured CSVs with correct naming convention
Result
Delivered within 48 hours. The project had a challenging start due to scope alignment, but the final result exceeded expectations.
