Tools › Operations Research › Networks and Routing › Facility Location › Method

Facility Location: Method

Open the free Facility Location (Center of Gravity)

Facility Location: Center of Gravity, Least-Distance Point, Several Facilities and Candidate Sites

The tool takes a list of demand points with their locations and weights and returns the center of gravity, the point of least weighted distance, the layout of one to five facilities (placed freely or chosen among listed candidate sites), a map drawn to scale and the cost for each number of facilities. It works with straight-line distances and describes the entered points; it is not a site recommendation.

The idea: every demand point pulls on the facility

Picture a map on a table with a hole at each customer. A string runs through each hole with a weight on it in proportion to what the customer receives, and the strings are knotted together above the table. The knot comes to rest where the pulls balance, and that resting point is the point of least weighted distance. The weighted average of the coordinates, which is what a spreadsheet "center of gravity" computes, is a different point: it balances weight times distance squared.

Five demand points of different weight joined to their weighted average, the center of gravity, which lies in the middle; the point of least weighted distance sits on the heaviest point
Five demand points drawn to scale. The heaviest point outweighs the combined pull of the other four, so the least-distance point is on it; the weighted average lies well away.

The equations

Demand point i is at ai = (xi, yi) with weight wi. With a transport rate ri the page uses vi = wi ri in place of the weight; without rates vi = wi. di is the distance from point i to its facility.

QuantityFormulaNote
Weighted distance (transport cost)C = sum of vi diwhat every search on the page minimizes
Center of gravityx = Σ vi xi ÷ Σ vi, y = Σ vi yi ÷ Σ viminimizes Σ vi di², not C
Weiszfeld's stepnew point = Σ (vi ai ÷ di) ÷ Σ (vi ÷ di)di measured from the current point; repeated until the point stops moving
Test of demand point j| Σ over i ≠ j of vi (aj − ai) ÷ |aj − ai| | ≤ vjif true, point j is the optimum
Rectilinear distanced = |x difference| + |y difference|the optimum is the weighted median of x and of y
Candidate sites (p-median)choose p sites to minimize Σ vi × (distance to the nearest chosen site) + Σ fixed costs
Great-circle distanced = 2 R asin √(sin²(Δφ ÷ 2) + cos φ1 cos φ2 sin²(Δλ ÷ 2))φ latitude, λ longitude, R = 6,371.0088 km

Center of gravity and least-distance point. Textbooks often present the weighted average as the point that minimizes shipping cost, or as a close approximation to it. It is the first only for squared distances. The two points coincide when the demand is symmetric, and they separate when one demand point is heavy or far: squaring lets a far point drag the average toward it. The page prints both, the cost at both, and the difference.

Weiszfeld's iteration. The least-distance point (the Weber point, also called the Fermat-Weber point or the geometric median) has no formula for more than three or four points. Weiszfeld (1937) gave the repeated weighted average in the table: each step uses weights vi ÷ di, so near points count more, and each step lowers the cost. The page starts at the center of gravity and stops when a step moves the point by less than one part in 1010 of the extent of the demand points.

When the optimum is a demand point. The step divides by di, so it is undefined on a demand point, and when a heavy customer is the optimum the plain iteration only creeps toward it. The test in the table settles it: add up the unit pulls of all the other points, each scaled by its weight; if the sum is no longer than the point's own weight, no move away from the point lowers the cost (Beck and Sabach, 2015, review the test and its history). The page tests the demand point nearest to each iterate. An iterate that lands on a demand point that fails the test is stepped off it along the combined pull by the step of Vardi and Zhang (2001), as given by Beck and Sabach.

Several facilities. With p facilities every demand point is served by its nearest one. The page alternates two steps (Cooper, 1963): assign every point to its nearest facility, then move every facility to the least-distance point of its points, until nothing changes. The result depends on the starting positions, so the page runs a number of seeded starts and keeps the lowest, then tries moving one facility at a time onto a demand point that is costly in that layout and keeps a move that lowers the cost. This is a heuristic. The cost table shows how many starts reached the kept result; when few did, a lower layout may exist. The search for each number of facilities also starts once from the layout with one facility fewer, so the cost curve never rises.

Candidate sites. When sites are listed, the question changes from "where" to "which": the p-median problem (Hakimi, 1964). The page tries every combination of p sites while the count is small (the table says how many), which is exact for the listed sites. Beyond that it adds sites one at a time and then swaps a chosen site for one not chosen while the total falls (the interchange of Teitz and Bart, 1968), and says so. A fixed cost per site is added to the transport cost; the two can be added only when the demand rows carry a rate that turns weight times distance into money for the same period.

Existing facilities stay where they are and serve the demand points nearest to them. The cost curve then starts at zero new facilities.

Latitude and longitude. Distances are great-circle distances on a sphere. The center of gravity is the weighted average of the latitudes and of the longitudes. The search runs on a map plane that keeps distances and directions from its center true (the azimuthal equidistant projection) and re-centers that plane on each facility until the facility stops moving, so each facility is the least great-circle-distance point of its demand points. Points on both sides of the 180th meridian are not handled.

What this tool adds to its neighbors. Trade Area (Huff Model) takes the sites as given and divides demand among competing stores by probability; Network Flow and Routing finds shortest paths and tours on an entered network; Transportation and Assignment ships from fixed sources with limited supply at entered unit costs. This tool answers the question before them: where the facilities would sit if only weight times distance counted.

What it assumes

  • Cost is in proportion to weight times distance (times an entered rate). There is no fixed charge per shipment, no rate taper with distance and no minimum load.
  • Distance is a straight line, a great circle or a rectilinear grid, times one circuity factor for the whole map. Roads, rivers, bridges and travel time are not in it.
  • Every demand point is served entirely by its nearest facility, and a facility can serve any amount. There are no capacities.
  • A facility can be placed anywhere (free locations) or at any listed site at its entered fixed cost (candidate sites).
  • Only outbound demand is counted. Inbound supply can be added as further "demand" rows at the suppliers with its own weight and rate.

When it misleads

  • The optimum is flat. Near the least-distance point the cost changes slowly: a site a few units away may cost a fraction of a percent more. Read the computed point as the center of a region, and compare real sites by listing them as candidates.
  • Straight lines across water or mountains. A point across a bay is near on the map and far by road. One circuity factor does not repair that.
  • Several facilities by a heuristic. With many demand points and four or five facilities the kept layout may not be the lowest. The count of starts that reached it is the page's only evidence.
  • More facilities always lower the weighted distance. The curve says nothing about how many to have until the cost of a facility is set against it (candidate sites with fixed costs do that).
  • Aggregated demand. A whole city entered as one point puts its weight at one spot; a facility inside the city then looks nearer to all of it than it is.
  • Service time. The least total distance can leave a small far customer very far away. The longest distance and the distance bands in the facility table show it; the page does not limit it.

Common mistakes

  • Reporting the weighted average of the coordinates as the least-cost location. It is the starting point of the iteration, not its end.
  • Averaging latitudes and longitudes over a large area and treating a degree of longitude as a fixed distance. It shrinks with latitude.
  • Mixing units of weight (tons for one customer, truckloads for another) or periods (a week for one, a year for another).
  • Adding a yearly fixed cost to a weighted distance in ton-miles. Enter a rate so that both are money for the same period.
  • Running the several-facility search once from one start and taking the answer as the optimum.
  • Forgetting inbound freight: a plant fed by one heavy supplier is pulled toward the supplier as well as toward its customers.
  • Reading the cost difference between the center of gravity and the least-distance point as large or small in general. It depends on the layout; the page computes it for the entered points.

Open the free Facility Location (Center of Gravity)