EN

How much does an H3 grid change where you put a warehouse?

Adaptive H3 repaired a constructed placement error. In a Madison road model, it chose the same hubs as the fixed grid and took longer.

How the grid moved a hub in a constructed case

Fixed H3 moved one of the three hubs and raised cost by 14.77% on the original points. Spread-based refinement recovered the point-level plan. The views share the same demand input, candidate sites, and map extent. Larger demand marks carry more weight.

Three maps use the same extent. Raw demand and Adaptive H3 select West, North and South. Fixed H3 selects Middle, North and South.
Raw demand and adaptive H3 keep the western site. Fixed H3 moves that hub toward the center of the bucket.
A zoomed H3 cell contains a heavy west lobe and lighter east lobe. The raw plan locates a hub at West. The fixed plan chooses Middle near the weighted centroid.
Fixed H3 combined two demand lobes into one weighted point. The model chose Middle in place of West, even though the heavier lobe was still at the western edge.

Results for the mapped case

Split-cell fixture, seed 271. Costs and p95 are scored on all 203 original points. A solver gap applies to its own model. Scroll the table to see all columns on a narrow screen.

MethodBucketsHubsCost
(demand-unit km)
p95 (km)Total (s)Gap
Raw demand203West, North, South2,328.466.960.0560%
Fixed H323Middle, North, South2,672.344.950.0350%
Adaptive H323West, North, South2,328.466.960.0160%
Weighted k-means23West, North, South2,328.466.960.1100%
Adaptive H3 (volume)23West, North, South2,328.466.960.0160%
Scatter plot of runtime versus point-level cost error over seven cases. Adaptive H3 by spread and weighted k-means match the raw plan on cost in every case. Fixed H3 and volume-based refinement show large errors in several split-cell cases.
Each mark is one method on one case. The circle highlights the fixed-H3 plan in the mapped fixture. Overlapping results share the same cost.

Why the constructed case moved a hub

In the mapped case, fixed H3 chose Middle where the point-level and spread-based adaptive plans chose West. Two lobes with unequal demand shared one H3 bucket. Replacing both with their weighted centroid made a candidate near that centroid attractive. On the original points, that choice moved total cost from 2,328.46 to 2,672.34 demand-unit km. The weighted p95 fell from 6.96 to 4.95 km, so the move improved the tail while increasing the objective. This is the largest fixed-H3 change among the three deliberately constructed split-cell cases.

How the comparison works

Each instance chooses three hubs from the same fixed candidates for all methods. The uncapacitated discrete p-median objective is the sum of each point’s demand weight times its straight-line distance to the closest open hub. The solver, time limit, and target gap stay fixed. Every chosen plan is then scored on the original points, including p95, the smallest distance that covers at least 95% of the demand weight. This follows the long-standing distinction between solving an aggregated location model and evaluating its decisions on disaggregated demand. Goodchild (1979) · Irawan, Salhi and Scaparra

Fixed H3 rolls resolution-8 indexes up to resolution 6 and puts one weighted centroid in each occupied bucket. Adaptive H3 starts at resolution 5 and splits selected buckets down to resolution 8. All aggregated methods get the same number of representatives as fixed H3 in each case. The volume rule splits by total demand. The spread rule splits by the sum of each point’s weighted distance to its bucket centroid. Weighted k-means gives a grid-free baseline with the same number of representatives. H3 parent-child membership is logical, so boundaries across levels are approximate on the map. H3 hierarchy · Cebecauer and Buzna (2017) · scikit-learn K-means

What held across the seven cases

  • Four regional seeds. Fixed H3 matched the raw hubs in three cases. In the fourth, it changed a hub and raised cost by 0.57%.
  • Three constructed split-cell seeds. Fixed H3 changed a hub in each case and raised cost by 13.06–14.77%. Spread-based adaptive H3 and weighted k-means recovered the raw hubs in all seven cases.
  • Spread versus volume. At identical bucket counts, spread won four cases on point-level cost and tied three. Its median total runtime was 0.032 s, compared with 0.028 s for fixed H3, 0.147 s for weighted k-means, and 0.317 s for raw demand. These are single-machine timings and include aggregation, model construction, solving, and scoring.

All 35 solves reported a 0% solver gap for their own models. A zero gap can certify a bucket-model result while the chosen hubs still score worse on the original points. On a small instance the MILP also picked the same two hubs as exhaustive enumeration of all six candidate pairs. The seven synthetic cases use straight-line distance and a fixed set of candidate sites. They show how refinement can help when a bucket hides a lobe of demand. SciPy MILP and HiGHS

Test the idea on the Madison road model

For the separate road study, 3,473 Madison-area Census block points stand in for demand, weighted by population. Candidate sites are illustrative. Travel times come from a bidirectional road graph with assumed speeds. The road study uses the same three-hub objective with minutes in place of kilometers, two matched bucket budgets, and an exact point-level reference. 2020 Census blocks · 2024 TIGER/Line

In the historical sensitivity runs, I shifted the candidate grid 1 km east and south, slowed two highway classes by 25%, and tried a denser candidate grid. Across the four scenarios and two budgets, spread-based H3 chose the same hubs as fixed H3 and took longer each time. At 18 buckets, both raised cost by 2.82% in the original case and by 3.04% with slower highways. The cost increase disappeared after shifting the candidates. At 83 buckets, fixed H3 and weighted k-means matched the exact plan in all four scenarios. Volume refinement sometimes changed the hubs. Sensitivity protocol · Raw sensitivity results

The chart shows the initial 24-candidate run. Its raw assignment MILP hit a 20-second limit on all three attempts. Exact enumeration checked all 2,024 candidate triples and found the optimum in about the same time as the 83-bucket fixed grid. A second implementation confirmed the original optimum. Published work also uses weighted travel costs and different p-median formulations to reduce aggregation error or improve solve times. Initial raw benchmark · Current and Schilling (1987) · Irawan, Salhi and Scaparra

Madison road results at 18 and 83 buckets. Fixed H3 costs the same as spread-based H3 at each budget and takes less time. Exact enumeration reaches zero excess cost at either budget.
Initial Madison run with 24 candidates. Times include routing. Cost is relative to the exact optimum on original demand. The dotted line marks the 1% cost threshold.

What changed the engineering decision

At 76 candidates there are 70,300 possible triples. I reran that pinned case with both the simple exact loop and a vectorized implementation that reuses the best service times for pairs. Each method ran three times in rotated order with the same route matrix per repetition. The medians below include routing and original-point scoring and exclude input loading and graph construction. This separate run used Windows 11, an Intel i7-8750H, and single-threaded BLAS.

Method Median with routing
Fixed H3, 83 buckets 1.65 s
Simple exact enumeration 5.96 s
Vectorized exact enumeration 4.15 s

All three methods selected M12, M33, and M62 in every repetition. On the original blocks, those hubs cost 2,165,118.79 resident-minutes with a weighted p95 of 13.28 minutes. The two exact implementations agreed on the objective and the hubs. The fixed-grid median was about 2.5× lower than vectorized enumeration in this run. Three-way raw results · Timing protocol and environment

For this workload, I would count the candidate combinations, try the simpler fixed grid, and score its plan on original demand before investing in adaptive refinement. At 24 sites the exact search was competitive. At 76, it gave a useful check on the quicker fixed grid. The road tests share one demand surface and use assumed speeds. Real warehouse decisions also depend on orders, truck access, parcel feasibility, and capacity.

Reproduce the figures

Run these commands from the h3-hub-placement repository. Figure regeneration reads the recorded benchmark files. To graph a rerun, pass its path with --input. The last command reproduces the new dense comparison without overwriting the historical results.

uv run --locked python -m hub_placement.benchmark --output outputs/benchmark-rerun.json
uv run --locked python -m hub_placement.figures
uv run --locked python -m hub_placement.metro --fetch --output outputs/metro-rerun.json
uv run --locked python -m hub_placement.metro_figure
uv run --locked python -m hub_placement.robustness --fetch --output outputs/robustness-rerun.json
uv run --locked python -m hub_placement.exact_baselines --fetch --output outputs/exact-baselines-rerun.json

The constructed maps and synthetic results use the fixed seeds in synthetic-v1. The Madison chart uses the recorded Census and road inputs described above. A future US ZIP-level study could allocate demand through a matching vintage of the HUD–USPS ZIP-to-tract crosswalk and assign each tract a Census representative point before H3 indexing. That approximation would need its own validation, especially for missing matches and ZIPs split across tracts. HUD–USPS crosswalk · 2024 Census Gazetteer

References