Modelling with Binary Variables
A variable restricted to zero or one records a yes-or-no decision, and a small vocabulary of linear constraints turns logical conditions into algebra: at most one of these, if this then that, this only if that is open. The patterns are few and compose, and the recurring error is writing a condition that is true of the situation but does not constrain the model.
Definition
A binary variable satisfies
A short vocabulary covers most conditions.
Selection count. At most one of a set:
Implication. "If
Linking a decision to a quantity. To allow a continuous quantity
with
Fixed charges. A cost incurred only if an activity runs is
On the choice of
Assumptions and scope
The meaning of each binary variable must be stated, including which outcome is 1. The algebra is symmetric between the two values and carries no interpretation of its own.
A linking constraint requires a valid upper bound
. If the bound is not genuinely an upper bound on the quantity the constraint forbids feasible plans; if it is loose the relaxation is weakened and the program becomes harder to solve. An implication constraint is directional.
says ifthen , and says nothing about what follows from . Writing instead asserts both directions and usually over-constrains the model.A constraint that is satisfied by every assignment the model can make restricts nothing, whatever it says about the situation. Checking that a proposed constraint forbids something is part of writing it.
Binary variables record decisions, not quantities. Summing them gives a count of decisions taken, which is meaningful; multiplying one by a rate as though it were an amount is not.
Worked material
Example
Five conditions, five constraints
A firm may open depots
"Open at most two depots."
"If
Forbidden:
"
"Nothing ships from a closed depot; each depot handles at most 500 tonnes."
Here
"An opened depot must ship at least 100 tonnes."
When
Check one combination.
Non-example
Constraints that are true and useless
Not a constraint:
Not a constraint:
Not an implication:
Not a link: a fixed cost in the objective with no constraint tying it to the activity. The binary is then pure cost with no consequence, so a maximising model sets it to zero and enjoys the activity free.
Not a bound derived from the situation:
Not a binary decision: a count. "How many vans to hire" is a general integer variable. Writing it binary forbids hiring more than one.
Contrast
True is not the same as binding
A constraint's job is to forbid something. Whether the sentence it encodes is true of the situation is a separate question, and conflating the two produces models that look thorough and constrain nothing.
A modeller reads "each depot can handle at most 500 tonnes" and writes
Why it is hard to see. Every constraint in the model is a true statement. Reviewing the model by reading the constraints and checking they are true will pass this model, because the fault is not a false statement. It is a missing one.
The test that catches it. For each constraint, name an assignment it forbids that the rest of the model would otherwise permit. For
The general shape of the error. It is not confined to binaries. Any model can contain constraints that restate something already implied, while a condition the modeller believes is covered has no algebraic representative at all. Binaries make it more common because logical conditions feel like they have been handled once they have been written down in words.
The habit. Two passes. Once through the constraints, asking what each forbids. Once through the description, asking which constraint enforces each condition. The second pass is the one that finds what is missing, and it is the one most often skipped.
Common errors
Common misconception
A constraint that makes a true statement about the situation is a correct constraint, so if the sentence is right the algebra must be doing its job.
Related units
Requires
Connected
- The Linear Relaxation and Its Bound (used by)
Learn this topic
Used in
Sources
- Integer Programming (2020)