// setup depends on the problem type
1. VARIABLES define what you choose, precisely:
xₕ = number of ___ per (unit & period)
2. OBJECTIVE Max z (profit) or Min z / w (cost)
z = c₁x₁ + c₂x₂ + ... + cₙxₙ
3. CONSTRAINTS one per limit; sense by wording:
"at most / available / capacity" → ≤
"at least / minimum / required" → ≥
"exactly / must equal" → =
4. SIGNS xₕ ≥ 0 (no negative amounts)
| Type | ① Variables | ② Objective | ③ Constraints (the shape) |
|---|---|---|---|
| Product-mix (MAX) |
xᵢ = units of product i to make | Max Σ (profit per unit)·xᵢ | one ≤ per shared resource: Σ(amount used per unit)·xᵢ ≤ amount available. Optional demand cap xᵢ ≤ Dᵢ. |
| Diet / blend (MIN) |
xᵢ = amount of ingredient i used | Min Σ (cost per unit)·xᵢ | one ≥ per requirement: Σ(nutrient per unit)·xᵢ ≥ minimum needed. |
| Scheduling (MIN) |
xᵢ = number of workers who start on day i | Min Σ xᵢ (total workers) | one ≥ per day: (day i's starter + the 4 previous days' starters) ≥ staff needed that day. Week is cyclic — "previous days" wrap around (Monday's 4 previous days are Thu, Fri, Sat, Sun). |
| Multi-period (MIN) |
per period t: xₜ made, yₜ overtime, iₜ inventory (dₜ = demand) | Min Σ (make + overtime + holding cost) | one = balance per period: iₜ = iₜ₋₁ + xₜ + yₜ − dₜ (end = start + made − shipped); iₜ ≥ 0; give i₀. Also cap regular production each period: xₜ ≤ capacity (overtime yₜ usually uncapped). |
// pure decision — read the finished model IF the model has exactly 2 decision variables: → GRAPHICAL (Step 3) ELSE: put every constraint into standard form: ≤ add slack (+s) ≥ subtract surplus (−e) AND add artificial (+a) = add artificial (+a) IF any constraint was ≥ or = (you added an artificial): → BIG-M (Step 4 setup, then Step 5) ELSE (every constraint was ≤): → SIMPLEX (straight to Step 5)
1. each constraint → a line (plot its two intercepts)
2. shade its feasible side: test the point (0,0)
TRUE → keep the origin side
FALSE → keep the far side
feasible region = overlap of all shaded sides (+ x ≥ 0)
3. list every corner:
axis corners + line∩line (solve the 2×2 by elimination)
keep only corners that satisfy ALL constraints
4. compute z at every corner
max → largest z min → smallest z
STOP → answer = that corner's (x₁,x₂) and its z
IF two corners tie for best → ALTERNATIVE OPTIMA (whole edge)
IF the region is empty → INFEASIBLE (no solution)
IF region open the improving way → UNBOUNDED (max only)
// a prefix that gives the loop a starting basis 1. any RHS < 0 ? multiply that row by −1 (flips its inequality) 2. (standard form already added s / −e / a in Step 2) 3. penalize the artificials in the objective: MIN: z = (original) + M·a₁ + M·a₂ + ... MAX: Z = (original) − M·a₁ − M·a₂ − ... 4. clear artificials out of Row 0 (they start basic): New Row 0 = Row 0 + M·(each artificial's row) [− for max] Row 0 now carries symbolic M coefficients → go to Step 5
// Row 0: z − c₁x₁ − c₂x₂ − ... = 0 // start: decision vars = 0, slacks = RHS, z = 0 REPEAT: ── optimality test ── MAX: every Row-0 coeff ≥ 0 ? ┐ yes → STOP (optimal) MIN: every Row-0 coeff ≤ 0 ? ┘ no → keep going ── entering variable (nonbasic → basic) ── MAX: the MOST NEGATIVE Row-0 coefficient MIN: the MOST POSITIVE Row-0 coefficient IF that column has no positive entry → STOP: UNBOUNDED ── leaving variable (basic → nonbasic): ratio test ── each row with a positive entry: ratio = RHS ÷ entry smallest ratio → that row leaves pivot element = entering column ∩ leaving row ── pivot ── divide the pivot row by the pivot element (→ 1) clear that column in EVERY other row, including Row 0: new row = old row − (its entry in that column)×(new pivot row) GO BACK TO REPEAT STOP → READ THE ANSWER: basic variable = its RHS · nonbasic variable = 0 · z = Row 0's RHS slack sᵢ = 0 → constraint binding · sᵢ > 0 → that much unused IF Big-M and any artificial > 0 → INFEASIBLE (LP has no solution)
| BV | z | x₁ | x₂ | s₁ | s₂ | RHS | Ratio |
|---|---|---|---|---|---|---|---|
| z | 1 | d₁ | d₂ | 0 | 0 | z | — |
| s₁ | 0 | • | • | 1 | 0 | b₁ | b₁ ÷ • |
| s₂ | 0 | • | • | 0 | 1 | b₂ | b₂ ÷ • |
| BV | z | x₁ | x₂ | s₁ | e₂ | a₂ | a₃ | RHS | Ratio |
|---|---|---|---|---|---|---|---|---|---|
| z | 1 | g₁ | g₂ | 0 | −M | 0 | 0 | cM | — |
| s₁ | 0 | • | • | 1 | 0 | 0 | 0 | b₁ | • |
| a₂ | 0 | • | • | 0 | −1 | 1 | 0 | b₂ | • |
| a₃ | 0 | • | • | 0 | 0 | 0 | 1 | b₃ | • |