Learn
Lesson · Integer Programming · Modelling with binaries

Fixed Charges, Facility Location and Big-M

A cost paid only if an activity happens at all needs a binary tied to the continuous activity by x ≤ M y. The link works for any M large enough, and that is the trap: every unit above the smallest valid value weakens the relaxation's bound, because the relaxation is then free to open a facility for a fraction of its fixed cost. The price is measurable, in bound and in nodes, on your own instance.

fixed charge x ≤ M y, y ∈ {0, 1} y = 0 forces x = 0 valid M at least every feasible x: capacity, or total demand the relaxation buys y = x/M a facility open for a fraction effective unit cost c_j + f_j/M 2 + 200/M = 6 + 60/M at M = 35 M = 30 bound 240 = the answer, 1 node M = 600 bound 70, y₁ = 1/20, 5 nodes — same answer, weaker proof
One link, and the price of the constant in it

Core ideas

What this lesson establishes

The link itself is one inequality and takes a minute. The lesson is the constant in it, which is a modelling decision with a measurable price and no error message.

1

The link is one inequality, and it works in one direction

x ≤ M y with y binary. At y = 0 the row reads x ≤ 0, which with x ≥ 0 forces x = 0: no activity without the decision. At y = 1 it reads x ≤ M, which is slack provided M is large enough. Note what it does not do: y = 1 never forces x to be positive, so paying a fixed cost for nothing stays feasible and is simply never optimal.

2

Validity has a reason, and the reason gives the tightest M

M must permit every x the rest of the model allows, so any upper bound on x is valid and the smallest such bound is best. A facility ships no more than its own capacity and no more than the whole demand, so the smaller of those two is valid and nothing smaller is. “A million” is not a reason; “total demand is 30” is.

3

Every unit above that is paid for twice

The relaxation does not have to choose y ∈ {0, 1}; it sets y = x/M, which is the cheapest value satisfying the row. Its effective unit cost becomes c_j + f_j/M, falling as M grows — so the bound decays toward the fixed costs being free. On the lab's instance the bound goes from 240, which is the answer, to 70; and the search that must close that gap goes from one node to five.

The material

A cost paid only if it happens, and the constant that links it

The fixed-charge row, the reason behind a valid M, and the measured cost of a careless one.

Definition · Fixed charge

A fixed charge is a cost f incurred if an activity x is positive and not otherwise. Modelling it needs a binary y with f y in the objective and the linking constraint x ≤ M y, where M is a constant at least as large as any feasible value of x.

The facility-location problem is this device repeated. Facilities have opening costs f_j, unit shipping costs c_j and capacities; demand must be met; and the objective is Σ f_j y_j + Σ c_j x_j. Without the binaries the model would ship a trickle from every facility and pay no opening cost at all, which is not what a warehouse costs.

Example · Two facilities, thirty units of demand

Facility 1 costs 200 to open and 2 a unit; facility 2 costs 60 to open and 6 a unit. Each can handle 40 units and demand is 30. Opening facility 1 costs 200 + 60 = 260; opening facility 2 costs 60 + 180 = 240. So the answer is 240, and every figure below is about how well a relaxation knows it.

The tightest valid M here is 30: no facility can ship more than the total demand, whatever its capacity says. At M = 30 the relaxation returns y₂ = 1 whole, a bound of 240, and a search tree that closes in a single node — the bound is the answer, so there is nothing left to prove.

What a loose M buys the relaxation

Put M = 600, twenty times the tightest, and nothing about feasibility changes. The relaxation now ships all thirty units from facility 1 and sets y₁ = 30/600 = 1/20, paying a twentieth of the opening cost: 10 + 60 = 70. The bound has fallen from 240 to 70 while the answer stayed 240, and the tree needs five nodes instead of one to prove it.

M bound y₁ nodes answer 30 240 0 1 240 60 160 1/2 5 240 150 100 1/5 5 240 600 70 1/20 5 240 1200 65 1/40 5 240

The shape of that column is the algebra: with y_j = x_j/M the objective contributes c_j x_j + f_j x_j/M, so facility j has an effective unit cost of c_j + f_j/M. As M grows the fixed cost is amortised over a larger and larger notional capacity, and the relaxation drifts toward the model in which opening a facility is free.

That also explains the bend. At small M, facility 2 is cheaper per unit: 6 + 60/30 = 8 against 2 + 200/30 = 26/3. The two cross where 2 + 200/M = 6 + 60/M, which is 140/M = 4, so M = 35 — and there the bound is exactly 1620/7. Above that value the relaxation prefers to half-open the expensive-to-build, cheap-to-run facility, and the bound decays from there without ever coming back.

Two things are worth separating. A loose M does not make the model wrong: every value in the table above returns the same integer answer, 240. What it costs is the bound, and therefore the proof and the work — which on a real instance is the difference between a tree that closes and one that does not.

An M that is too small is a different and worse failure. It is not a weak bound, it is a wrong model: the row x ≤ M y then forbids shipping quantities the situation permits, and the answer it returns is the optimum of a problem nobody asked about. This is why the reason matters more than the number: “the facility's capacity” cannot be too small, and a value chosen by feel can be.

Interactive

Fixed charges and the size of M

A binary linked to an activity, and the bound you pay for every unit of slack in the link

The price of a loose Mevery unit of M past the smallest valid one weakens the bound and buys nothing
the bound against Ma breakpointthe bound against demandthe integer answer

Method

Sizing a big-M, with a reason attached

Five steps, and the second is the one that separates a modelling decision from a habit.

1

Write the fixed cost and the link together

f y in the objective and x ≤ M y in the rows. One without the other is either a cost nothing controls or a decision nothing charges for, and both produce models that solve and mean nothing.

2

Name the upper bound on the activity, in words

“This facility's capacity.” “Total demand.” “The largest order any customer can place.” Then take the smallest of the bounds you can justify. The words are the deliverable; the number is derived from them.

3

Solve the relaxation and read the binaries

A y at 1/20 is the relaxation telling you what it bought. Anything strictly between 0 and 1 means a fixed cost has been charged fractionally, which is the one thing the binary existed to prevent.

4

Measure the loose M against the tight one

Same instance, two values of M, two bounds and two node counts. “A loose M is bad practice” is folklore; “on this instance it moved the bound from 240 to 70 and the tree from one node to five” is an engineering result.

5

Keep the reason next to the number

In the model, as a comment or a line of prose. Six months later the only way to tell a justified M from a guess is that the justified one says why, and the only way to safely tighten one is to know what it was bounding.

Links, constants and what they cost

Score 0 / 0

Two facilities, and the bound at three values of M

One instance, solved exactly at each M. The answer never moves; everything else does.

facility 1 open 200 ship 2 a unit capacity 40 facility 2 open 60 ship 6 a unit capacity 40 demand 30 min 200y₁ + 60y₂ + 2x₁ + 6x₂ x₁ + x₂ = 30, x₁ ≤ M y₁, x₂ ≤ M y₂, y ∈ {0, 1} the integer answer open 1 only: 200 + 2(30) = 260 open 2 only: 60 + 6(30) = 240 ← the optimum tightest valid M = 30, because total demand is 30 and no facility can ship more than that, so 30 is valid and nothing smaller is M = 30 relaxation: y₂ = 1 whole, z = 240 1 node M = 60 relaxation: y₁ = 1/2, z = 160 5 nodes M = 600 relaxation: y₁ = 1/20, z = 70 5 nodes why the bound falls: y_j = x_j/M, so unit cost is c_j + f_j/M facility 1 2 + 200/M facility 2 6 + 60/M equal when 140/M = 4, i.e. M = 35, where the bound is 1620/7 at M = 600: 2 + 1/3 = 7/3 against 6 + 1/10 = 61/10 so all 30 units go from facility 1 at 7/3 each = 70

The first row of that table is the one to want. At the tightest M the relaxation returns a whole y and a bound equal to the answer, so the search closes immediately — the model did the work that would otherwise be a tree.

Notice that the node count jumps from one to five as soon as M leaves its tightest value and then stops changing. The bound keeps decaying smoothly, the work does not: a weaker bound costs nothing until it stops closing a node, and then it costs a subtree. That is why the price of a loose M has to be measured rather than estimated.

For a faded rehearsal, use the lab's demand slider to raise demand to 45 and re-derive the tightest valid M. The supplied first move is that total demand is no longer the binding bound — 45 exceeds either capacity, so the capacity is now what limits a single facility. Say what the tightest M becomes and why, then check the panel, and then say whether one facility can still meet demand alone.

Common mistakes

1
Setting M to a million to be safeIt is safe for feasibility and ruinous for the bound. On the lab's instance the bound at the tightest M is the answer itself; a million takes it toward 2(30) = 60, the shipping cost alone with the opening cost amortised away into nothing, and the tree has to close every unit practice” but a number: here is the bound I lost and here are the extra nodes.
2
Choosing M by feel rather than by boundAn M that happens to be too small does not weaken anything — it deletes feasible plans and returns a confident answer to a different problem. That failure is silent, because the model still solves. A value derived from a stated upper bound on the activity cannot make this mistake; a value chosen because it “looks big enough” can.
3
Rounding the fractional y up and calling it a solutionReplacing the binary by x/M and rounding up is not a constraint at all: it is a post-processing step with no argument behind it. Whether the rounded-up plan is feasible, and whether it is anywhere near best, are the two questions “When Rounding Fails” answered with no and no.

Check your understanding

✓
Finish when a big-M in someone else's model is a question you ask, with a number ready to measure the answer.

You should be able to write a fixed-charge link and say what each value of the binary forces, justify the tightest valid M from an upper bound on the activity, predict which facility a loose M makes the relaxation half-open, and report the bound and the node count at two values of M on the same instance.

Note: Replacing the binary by x/M and rounding up is not a constraint at all — it is the fallacy of “When Rounding Fails” one level up, applied to a variable that was invented to prevent it. It is named here as that rather than as a separate error, because a reader who has watched (9/4, 3/2) fail to round has already been given the argument.

Kept in this browser only, for you. Nothing is sent anywhere and nothing checks it. Carry it to another device.

Feedback and recommendations

Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.

No recommendations yet for this lesson.