Whether a coffee shop can survive depends on its products for three points and its location for seven points.
What about the two thousand families? In addition to location, there is a more expensive problem: 450 tons of materials are sent from the central warehouse to 2,500 stores every day. How to organize this distribution network?
The former is a site selection issue, and the latter is a network design issue. In traditional chain companies, these two things are usually solved by two sets of people and two sets of experience - the site selection team looks at the flow of people, competing products, and rents; the logistics team sets up warehouses, dispatches vehicles, and divides areas based on experience. When the scale reaches hundreds or even thousands of stores, experience will hit two walls at the same time: location selection depends on feeling, and it takes a year to know whether it is right or wrong; network distribution depends on experience, but costs are incurred every day.
We recently made a system to put these two things into the same optimization framework and calculate them at once. Let’s first use a simulation case to see the results, and then briefly talk about the technical ideas behind it.
Let’s take a look at the results first: 2,500 stores in a “synthetic city”
In order to verify the system, we generated a reproducible simulated city: a crowd density field composed of several Gaussian "business district centers" and main road corridors, superimposed 400 competing stores, and then asked the system to answer two questions -
Question 1: Where is the store located, how many levels are it divided into, and how much money can each earn?
The system completed the S/A/B/C four-level store layout on the density field:
" alt="" loading="lazy">
- A total of 2,500 stores: 500 S-level stores, 750 A-level stores, 750 B-level stores, and 500 C-level stores;
- The total daily revenue of the entire network is 30.71 million yuan;
- The revenue gap between levels clearly reflects "location is pricing": the average daily revenue of S-level stores is 25,629 yuan, and the best single store achieves 53,407 yuan/day, which is more than 5 times the average level of C-level stores.
The revenue of each store is not photographed, but calculated based on the Huff gravity model: Which store a customer chooses depends on the store's "attractiveness" (area, brand, visibility) divided by distance attenuation, and then shares the same flow of people with all surrounding competitors (including the 400 competing stores). In other words, this revenue forecast takes into account "a competing product opened next door" from the first day.
Question 2: Where does the goods come from, who passes by, and which way does it take?
The system provides a two-level distribution plan for 16 satellite warehouses - the central warehouse uses trucks to run the first-level trunk line, and the satellite warehouses use box cargo to do the second-level short-distance barge:
" alt="" loading="lazy">
- 16 satellite warehouses (all L-level, single warehouse capacity 40 tons/day), with a total throughput of 450 tons/day, which is exactly equal to the total distribution demand of 2,500 stores;
- Each warehouse serves an average of 156 stores, and the load among warehouses is highly balanced. Six warehouses are pressed to nearly full capacity - there are no idle warehouses and no overloaded warehouses;
- The total delivery cost of the entire network is 137,751 yuan/day, accounting for only 0.45% of the daily revenue of the entire network.
If you put the location selection and delivery together in one picture, it looks like this:
" alt="" loading="lazy">
The purple dotted line is the truck trunk line (central warehouse → satellite warehouse), and the light-colored thin line is the cargo short-term barge (satellite warehouse → store). Where the crowd density is high, there are dense stores and satellite warehouses; in the periphery where the density is low, a small number of warehouses radiate over a large area. The location of the warehouse is not taken by the administrative district, but is fed by demand.
Where else can this set of things be used?
The method itself has nothing to do with coffee - any business with "intensive front-end distribution + back-end multi-level distribution" is based on the same problem. Several typical application scenarios:
- Expansion plan of restaurant/coffee and tea chain. This is the most straightforward scenario. How many stores to open each year, in which business district to open them, how to mix flagship stores (S-level) and stall stores (C-level), how much revenue will be diverted when competitors open stores next to them - these decisions that used to rely on franchisee experience and layer-by-level reporting can be turned into a sorted list with revenue forecasts.
- Instant retail and front warehouse network. The "site selection + large warehouse → front warehouse → user" structure of the fresh food and daily warehouses is almost the same structure as the "central warehouse → satellite warehouse → store" in this case. The difference is that the delivery object changes from a store to a grid, but the skeleton of the coverage model (MCLP) and two-level network optimization can be reused as it is.
- Hierarchical distribution of chain drug stores + joint delivery. Pharmacies have clear community coverage logic and are sensitive to delivery timeliness. The coverage model ensures the service radius, and the network layer determines the number of regional warehouses and distribution routes, which is especially suitable for the "large but scattered" county market.
- Community group buying/area reconstruction of FMCG dealers. Traditional dealer areas are often divided along historical boundaries. The system can be re-divided according to actual needs: which areas should be equipped with shared distribution centers, what stalls should be opened in the centers, and what models should be used for each line, directly providing cost-comparable solutions.
- Urban logistics and "last mile" policy evaluation. The two-level network (difficult for large vehicles to enter the city→satellite warehouse to replace small vehicles) is exactly the structure of joint distribution pilot projects in many cities. This set of models can be used to evaluate "how many transfer nodes are set up, where they are set up, and how many vehicle kilometers can be saved."
The common point is that on-site decisions (whether to open, where to open) and online decisions (warehouses, vehicles, roads) are calculated together under the same cost caliber to avoid "site selection wins revenue, but distribution eats up gross profit."
Technical solution: One-sentence version + three-layer disassembly (you can skip it if you are not interested)
The site selection is scored using the "coverage + revenue" dual model, and the distribution is scored using the "site selection-path decomposition iteration". All are completed at the minute level using a mature operations optimization solver.
Specifically:
|
layer |
what to do |
model used |
|
Location layer (L1) |
Select points from candidate points to maximize crowd coverage, use the Huff model to predict the expected revenue of each point, consider competition diversion, and output a ranking list |
Maximum coverage site selection model (MCLP, classic model in 1974) + Huff gravity model + greedy sequential site selection |
|
Network layer (L2) |
Determine the number, location, and capacity of satellite warehouses, as well as the two-level path of "central warehouse → satellite warehouse → store" |
Warehouse location problem with capacity constraints (CWLP) + two-level vehicle routing problem (2E-VRP) |
|
coupling layer |
The real path cost calculated by L2 is fed back to the site selection score of L1, and iterates until the total cost converges. |
Master-subproblem iteration similar to Benders decomposition |
There are several options worth mentioning in engineering:
- Not looking for fancy, looking for reproducibility. The solver uses Google’s open source OR-Tools (CP-SAT + Routing), and the selection conclusion is very clear: at this scale (hundreds of candidate points, thousands of stores), precise MIP + heuristics are enough, without touching deep learning. All test instances have fixed random seeds, and the results of anyone re-running will be consistent point by point;
- There is no ready-made model for two-level VRP (OR-Tools does not have a built-in two-level problem). We separate the "satellite warehouse location allocation (MIP)" and the "two-level path (solve CVRP separately)" to solve them alternately, and use the real path cost to continuously correct the main problem - this is the mainstream engineering solution to the 2E-LRP problem in academia;
- Shipping methods optional. There are three grades of warehouses: small/medium/large (fixed cost ↑, unit cost ↓), and vehicles include truck/van/new energy and other models. The solver automatically selects the lowest-cost compliance combination for each line;
- Distance can be upgraded. The current demo uses the Euclidean distance × 1.3 detour coefficient, and the interface reserves the OpenStreetMap real road network (OSMnx). There is no need to change the model when changing to real city data.
The complete context of technical research (from Church & ReVelle in 1974 to the large-scale 2E-LRP in 2025) is a separate article and will not be discussed here.
From Demo to implementation, there are three pieces of data missing
This demo uses synthetic data. To switch to real business, you only need to replace three inputs:
- Crowd density (GeoJSON): mobile phone signaling, takeout order heat, and POI passenger flow are all acceptable;
- Candidate list (CSV): rent, area, visibility, competitive product mark;
- Cost parameters (JSON): fixed costs and grades of warehouses, vehicle models and mileage costs, and daily delivery volume of a single store.
The output is two lists: a sorted site selection recommendation table (coverage of each candidate point, expected revenue, competitive diversion ratio), and a distribution network plan (satellite warehouse location + stall, which stores each warehouse serves, two-level path details, cost composition). From data input to map report output, it can be completed within 5 minutes on a standard scale.
write at the end
The competition in chain expansion is on the surface a competition on the number of stores, but behind it is a competition on the quality of decision-making. For the same 2,500 stores, the site selection list covers a few more high-value business districts, and the distribution network opens two less unnecessary warehouses. The cost savings and improved revenue in a year may be the most practical lines on the income statement.
Experience is still important - but the best use of experience is to teach the model and then let the model calculate the 2,500-point plan for the entire city at four o'clock in the morning.
Machine-translated from the Chinese original 从选址到配送,把连锁扩张交给算法 (published 2026-10-16). WeChat original ↗