Locating warehouses and facilities
Location factors, the optimal weighted median on a line proved, the centre of gravity and least squares proved, a comparative example, the Weber problem and multiple facilities.
Where should a warehouse, a plant, a service centre be built? The choice locks in transport costs and delivery times for decades. In this lesson we look at location factors, the problem on a line with the proof that the weighted median minimises total distance, the centre of gravity with the proof that it minimises the sum of squares, an example comparing them, and models for several facilities.
The factors
Location choices combine quantitative factors (inbound and outbound transport costs, cost of land, labour and energy, taxes and incentives) and qualitative ones (availability of skilled staff, infrastructure, proximity to customers and suppliers, political stability, environmental constraints). Qualitative factors are often assessed with a weighted scoring table; transport factors with mathematical models, starting from the simplest.
Location on a line
Consider customers along a road, at positions
, with demands (weights)
: number of deliveries or tonnes per year. Transport cost is proportional to weight times distance, and we seek the warehouse position
minimising
![]()
Theorem. The cost is minimum at the weighted median: a point where the total weight of customers to the left and that of customers to the right each do not exceed half the total.
Proof. Moving the warehouse a small distance
to the right, the distance to every customer on the left increases by
and that to every customer on the right decreases by
: the cost changes by
, where
and
are the weights to the left and right. It pays to move right as long as
, left as long as
. One stops at the point where neither exceeds half the total weight, i.e. at the weighted median. ∎
Remarkably, the solution does not depend on the customers’ distances, only on their order and weights: a very distant customer does not “pull” the warehouse more than a nearby one in the same direction.

Example. Weights 10, 30, 20, 15, 25 (total 100) at kilometres 0, 10, 25, 40, 60. Accumulating from the left: 10, 40, 60. Half, 50, is passed at the customer at kilometre 25: that is the median, and the cost is
(tonne-kilometres).
The centre of gravity
A widely used method is the centre of gravity, i.e. the weighted mean of the positions,
. What does it minimise?
Theorem. The centre of gravity minimises the weighted sum of squared distances,
.
Proof. The function is a parabola in
with derivative
, which vanishes for
, i.e. at the centre of gravity; the second derivative
is positive. ∎
In the example the centre of gravity is at kilometre
, where the total distance is 1880: 4 % more than the median. The centre of gravity overweights distant customers, because distances count squared; for transport costs, which grow roughly linearly with distance, it is only an approximation, convenient as a starting point.
In the plane and with several facilities
In the plane with rectilinear distances (grid streets, warehouse aisles) the problem separates into the two coordinates, and the solution is the weighted median of the
and that of the
. With straight-line distances (the Weber problem) there is no formula, but Weiszfeld’s iterative algorithm converges starting from the centre of gravity. With real road distances geographic information systems are used.
With several facilities to locate the problem becomes combinatorial: choosing among candidate sites which to open and assigning customers to each, balancing the fixed opening costs (which push towards few facilities) against transport costs and inventory (which push towards many, subject to the square-root law, lesson on the supply chain). It is formulated as integer linear programming and solved with optimisation software, which today handles networks with hundreds of candidate sites and thousands of customers.




