Linear programming formulation and graphical method
Formulating linear programmes from production problems and solving two-variable LPs by the corner-point and iso-profit graphical method, including special cases.
Drafted with Aria, reviewed by the AiCanCode.org team. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Linear programming (LP) is the workhorse of production planning: product mix, machine loading, blending, cutting and transport decisions are all LPs. Before any algorithm can help, the shop-floor problem has to be translated correctly into variables, an objective and constraints. The graphical method then shows, for two variables, exactly why LP optima sit at corner points, which is the idea every later method (simplex, duality, sensitivity) builds on.
Key ideas
Formulation in three steps.
- Decision variables — what the manager actually controls, with units (e.g. x₁ = units of product A per week). Define them before writing anything else.
- Objective function — a linear expression to maximise (profit, contribution) or minimise (cost, time).
- Constraints — linear limits on resources (machine hours, material, labour, demand) written as ≤, ≥ or =, plus the non-negativity conditions x ≥ 0.
Assumptions of LP. Proportionality (profit and resource use grow linearly with each variable), additivity (no interaction terms), divisibility (variables may take fractional values) and certainty (all coefficients known and constant). If divisibility fails, the problem becomes an integer programme.
Graphical method (two variables).
- Draw each constraint as a line by taking its intercepts, then shade the side that satisfies the inequality (test with the origin if it is not on the line).
- The intersection of all shaded sides with x₁, x₂ ≥ 0 is the feasible region. It is always a convex set; it can be bounded (a polygon), unbounded, or empty.
- Corner-point theorem: if an LP has a finite optimum, at least one corner (extreme point) of the feasible region is optimal. So evaluate Z at every corner, or slide an iso-profit (iso-cost) line Z = k parallel to itself until it last touches the region.
Special cases you must recognise.
- Alternative (multiple) optima — the objective line is parallel to a binding constraint edge; every point on that edge is optimal.
- Unbounded solution — the region is open in the direction of improvement (maximisation over a region extending to infinity). A minimisation over an unbounded region can still have a finite optimum.
- Infeasible problem — the constraints have no common point.
- Redundant constraint — a constraint that does not touch the feasible region; removing it changes nothing.
Connection to later topics. Corner points of the graph are exactly the basic feasible solutions the simplex method moves between; slack in a constraint at the optimum is what duality and sensitivity analysis interpret as an unused resource with zero shadow price.
Formulas
- Objective:
Max (or Min) Z = c₁x₁ + c₂x₂ + … + cₙxₙ - Constraints:
aᵢ₁x₁ + aᵢ₂x₂ + … + aᵢₙxₙ (≤, =, ≥) bᵢ, i = 1 … m - Non-negativity:
xⱼ ≥ 0 - Intercepts of a constraint line:
x₁ = bᵢ / aᵢ₁(when x₂ = 0),x₂ = bᵢ / aᵢ₂(when x₁ = 0) - Iso-profit line slope:
dx₂/dx₁ = −c₁ / c₂
Symbols: xⱼ = level of activity j (units, kg, hours… as defined); cⱼ = profit or cost per unit of xⱼ (₹/unit); aᵢⱼ = amount of resource i used per unit of xⱼ (e.g. h/unit); bᵢ = amount of resource i available or required (e.g. h). These hold under the four LP assumptions above.
Worked examples
Example 1 (standard product mix). A shop makes doors (x₁) and windows (x₂) with profits ₹3 thousand and ₹5 thousand per unit. Plant 1 has 4 h, Plant 2 has 12 h and Plant 3 has 18 h available per week. A door uses 1 h in Plant 1 and 3 h in Plant 3; a window uses 2 h in Plant 2 and 2 h in Plant 3.
- Model:
Max Z = 3x₁ + 5x₂subject tox₁ ≤ 4,2x₂ ≤ 12,3x₁ + 2x₂ ≤ 18, x₁, x₂ ≥ 0. - Lines: x₁ = 4; x₂ = 6; 3x₁ + 2x₂ = 18 with intercepts (6, 0) and (0, 9).
- Corner points: (0, 0), (4, 0), (4, 3) from x₁ = 4 and 3x₁ + 2x₂ = 18 → 2x₂ = 6, x₂ = 3; (2, 6) from x₂ = 6 and 3x₁ + 12 = 18 → x₁ = 2; (0, 6).
- Z values: 0, 12, 27, 36, 30 (₹ thousand).
- Optimum: x₁ = 2 doors, x₂ = 6 windows, Z = ₹36 thousand per week. Plants 2 and 3 are fully used; Plant 1 has 2 h of slack.
Example 2 (GATE-type minimisation). A feed is blended from ingredient A (₹20/kg) and B (₹30/kg). Each kg of A gives 2 units of protein and 1 unit of fat; each kg of B gives 1 unit of protein and 3 units of fat. A batch needs at least 8 units of protein and 9 units of fat. Find the cheapest blend.
- Let x₁, x₂ = kg of A and B.
Min Z = 20x₁ + 30x₂subject to2x₁ + x₂ ≥ 8,x₁ + 3x₂ ≥ 9, x₁, x₂ ≥ 0. - The region lies above both lines and is unbounded, but costs are positive, so a finite minimum exists.
- Corner points: (0, 8) on the x₂-axis; (9, 0) on the x₁-axis; intersection: x₁ = 9 − 3x₂ → 2(9 − 3x₂) + x₂ = 8 → 18 − 5x₂ = 8 → x₂ = 2, x₁ = 3.
- Costs: Z(0, 8) = ₹240; Z(3, 2) = 60 + 60 = ₹120; Z(9, 0) = ₹180.
- Optimum: 3 kg of A and 2 kg of B, minimum cost ₹120 per batch, with both nutrient constraints binding.
- Check with the iso-cost slope: −20/30 = −0.667 lies between the constraint slopes −2 and −1/3, so the intersection, not an axis point, is optimal.
Common mistakes
- Writing the objective before defining variables and units, then mixing per-hour and per-unit data.
- Shading the wrong side of a ≥ constraint; always test a point such as the origin.
- Missing a corner point where a constraint meets an axis, or forgetting x ≥ 0.
- Declaring a minimisation "unbounded" just because the region is unbounded; only the direction of improvement matters.
- Assuming the optimum is unique: if the objective line is parallel to a binding edge there are infinitely many optima with the same Z.
- Rounding a fractional LP optimum to integers and assuming it is still optimal — that needs integer programming.
For GATE PI
- Two-variable LPs with three or four constraints: find the optimal Z or the optimal point by corner-point evaluation (quick NAT questions).
- Identify special cases: alternative optima, unbounded, infeasible, redundant constraint.
- Formulation from a short word problem (product mix, blending) and recognising which constraints are binding.
- Practise solving 2×2 line intersections fast and checking the answer with the iso-profit slope.
Quick check
- Max Z = 2x₁ + 3x₂ subject to x₁ + x₂ ≤ 4, x₁, x₂ ≥ 0. What is the optimal Z?
- Can a minimisation LP with an unbounded feasible region have a finite optimum?
- Max Z = x₁ + x₂ subject to x₁ + x₂ ≤ 5, x₁, x₂ ≥ 0. How many optimal solutions are there?
- Which LP assumption is violated if machines can only be bought in whole numbers?
Answers: 1. 12 at (0, 4). 2. Yes, if the objective does not improve indefinitely in the open direction (e.g. positive costs). 3. Infinitely many — every point on the edge x₁ + x₂ = 5. 4. Divisibility.
Interview questions
All Operations Research interview questionsTry answering each one aloud before you open it.
1.What is linear programming and why is it important in operations research?Concept
Linear programming optimises (maximises or minimises) a linear objective function of decision variables subject to linear equality or inequality constraints and non-negativity. It rests on proportionality, additivity, divisibility and certainty. It matters because product mix, blending, machine loading, transportation and assignment decisions can all be modelled this way and solved exactly and quickly, with shadow prices that tell managers what each scarce resource is worth.
2.Explain the graphical method of solving a linear programming problem.Concept
The graphical method involves plotting the constraints of a linear programming problem on a graph. The feasible region is identified where all constraints overlap. The objective function is then plotted, and the optimal solution is found at the vertex or corner point of the feasible region that maximizes or minimizes the objective function.
3.What are the limitations of using the graphical method in linear programming?Concept
The graphical method is limited to solving linear programming problems with only two decision variables because it relies on a two-dimensional graph. It becomes impractical for problems with more than two variables, where other methods like the Simplex method are more suitable.
4.Why is the feasible region important in linear programming?Application
The feasible region represents all possible solutions that satisfy the constraints of a linear programming problem. It is important because the optimal solution must lie within this region. Without identifying the feasible region, it would be impossible to determine the best solution that meets all constraints.
5.What happens if the feasible region is unbounded in a linear programming problem?Application
If the feasible region is unbounded, it means that the solution can extend infinitely in one or more directions. In such cases, the linear programming problem may not have a finite optimal solution, especially if the objective function is to be maximized. However, if the objective function is to be minimized, a finite solution might still exist.
6.How does the Simplex method differ from the graphical method in solving linear programming problems?Application
The Simplex method is an algebraic approach that can handle linear programming problems with more than two variables, unlike the graphical method which is limited to two variables. The Simplex method iteratively moves along the edges of the feasible region to find the optimal solution, making it suitable for larger and more complex problems.
7.Why is it necessary to convert inequalities into equalities in linear programming?Application
Algebraic methods such as simplex work on a system of linear equations, so each ≤ constraint gets a slack variable (unused resource) and each ≥ constraint gets a surplus variable (amount above the requirement). Artificial variables are not part of this conversion; they are added afterwards to ≥ and = rows only to provide a starting basic feasible solution and must be driven to zero (Big-M or two-phase).
8.Maximise Z = 3x + 2y subject to x + y ≤ 4, x − y ≥ 1, x, y ≥ 0 using the graphical method.Numerical
The feasible region is the triangle with corners (1, 0), (4, 0) and (2.5, 1.5), the last from x + y = 4 and x − y = 1. Evaluating Z: Z(1, 0) = 3, Z(2.5, 1.5) = 10.5, Z(4, 0) = 12. The optimum is x = 4, y = 0 with Z = 12; the corner (4, 0), where x + y = 4 meets the x-axis, is easy to miss if you only check the intersection of the two constraint lines.
9.Maximise P = 5x + 7y subject to 2x + 3y ≤ 12, x + 4y ≤ 8, x, y ≥ 0 using the graphical method.Numerical
The two lines meet at x = 8 − 4y → 2(8 − 4y) + 3y = 12 → y = 0.8, x = 4.8. The corners are (0, 0), (6, 0), (4.8, 0.8) and (0, 2), giving P = 0, 30, 29.6 and 14. The optimum is x = 6, y = 0 with P = 30: the first constraint is binding and the second has slack of 2.
10.Explain the role of slack variables in linear programming.Concept
Slack variables are added to less-than-or-equal-to constraints to convert them into equalities. They represent the unused resources in the constraints and allow the use of methods like the Simplex method, which require equations rather than inequalities.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?