Solve two‑variable linear programming problems using the graphical method. Enter objective function (max/min) and up to four constraints. Visualize feasible region, objective line, and optimal vertex.
Linear programming (LP) is a mathematical technique for optimizing a linear objective function subject to linear equality and inequality constraints. Developed by George Dantzig in 1947, it remains a cornerstone of operations research. This tool solves two‑variable problems using the graphical method and introduces sensitivity sliders to explore how changes in parameters affect the optimal solution.
When you drag a right‑hand side (RHS) slider, the corresponding constraint line shifts parallel. The feasible region expands or shrinks, and the optimal vertex may slide along an edge. The rate at which the optimal objective changes per unit increase in RHS is precisely the shadow price (dual variable) of that constraint. Similarly, changing objective coefficients rotates the objective line; the optimum may jump to a neighbouring vertex when the slope passes a critical value – this is the basis of ranging analysis.
The "Calculation Steps" panel shows these intersections, the feasibility test, and the objective values at each vertex for the current input.
Click any preset button to load the example.
| Type | Objective & Constraints | Optimal (x₁,x₂) | Optimal Z | Status |
|---|---|---|---|---|
| Product mix (max) | Z=3x₁+2x₂; x₁+x₂≤4, x₁≤3, x₂≤3, 2x₁+x₂≥2 | (3,1) | 11 | Unique |
| Diet (min) | Z=2x₁+3x₂; x₁+2x₂≥6, 2x₁+x₂≥4 | (2,2) | 10 | Unique |
| Infeasible | x₁+x₂≤1, x₁+x₂≥3 | — | — | No feasible region |
| Unbounded (max) | Z=x₁+x₂; -x₁+x₂≤1, x₁,x₂≥0 | unbounded | ∞ | Unbounded |
| Multiple optima | Z=2x₁+2x₂; x₁+x₂≤4, x₁≤3, x₂≤3 | edge (1,3)–(3,1) | 8 | Multiple |
A workshop produces chairs (x₁) and tables (x₂). Profit per unit: $30 for chairs, $40 for tables (Z = 30x₁ + 40x₂). Wood: 2x₁ + 4x₂ ≤ 80 board feet, labour: 3x₁ + 2x₂ ≤ 60 hours, demand: x₁ ≤ 15, non‑negativity. Using the solver, we find the optimum at (10,15) with profit $900. Drag the wood‑RHS slider: increasing it shifts the wood constraint outward; the profit rises by the shadow price ($5 per additional board foot) until a new constraint becomes binding. This interactive exploration is exactly what managers use for "what‑if" analysis.
For problems with more than two variables, we use the simplex algorithm. The vertices we enumerate here correspond to basic feasible solutions in simplex. Every LP has a dual problem; the dual variables (shadow prices) are the rates at which the optimal objective changes when constraints are relaxed. The sliders in this tool let you experience duality without algebra: watch the optimal value change as you move a RHS slider.