Auditing an LP Formulation for Correctness
Systematic checks for catching modeling errors in a linear program before solving: unit consistency, inequality direction, coefficient-vs-variable-definition alignment, and completeness of the constraint set.
Tutorial
Auditing Units in the Objective and Constraints
Before solving an LP, audit it. The first and most mechanical check is dimensional consistency.
Every term inside a single sum must share the same units. Every comparison (LHS vs. RHS, or each term of the objective) must produce the same units. If the objective is in dollars, every term must work out to dollars. If a constraint's RHS is in labor-hours, every term on the LHS must be in labor-hours.
The coefficient on must carry the units of (RHS units) per (units of ).
For instance, suppose a bakery makes loaves of bread and cakes, where bread uses kg of flour per loaf, cake uses kg per cake, and kg of flour is available. The flour constraint is
Units check: , and the RHS is in kg. ✓
Now consider a flawed version that someone wrote in a hurry:
where the was copied from a different data row meaning "minutes of oven time per cake." The LHS mixes kg and minutes — the audit catches this immediately.