Linear Programming: Computer Solution
Encode, solve, and verify a linear program
A computer solver needs explicit decision variables, a linear objective, and constraints before it can optimize. Its output describes the model actually entered. Checking that output against the intended units and resource limits is part of solving the problem.
Model inputs
Define what each variable counts and give its units. Specify whether the objective is to maximize or minimize, then multiply each variable by the value or cost per unit. For each resource, multiply production by resource use per item and compare the total with the available capacity.
An upper resource limit uses ≤, while an exact requirement uses equality. Include explicit nonnegativity bounds when negative production has no meaning. A solver cannot enforce an omitted limit or infer a different inequality direction from the story.
Worked example
A workshop earns 7 credits per item A and 3 per item B. Each A uses 2 machine-hours, each B uses 1, and 14 hours are available. With no other stated limits, enter maximize 7A+3B subject to 2A+B≤14 and A,B≥0.
The candidate A=7,B=0 uses 14 hours and earns 49 credits, so it is feasible. For this simple model, 7A+3B≤(7/2)(2A+B)≤49, because B≥0. That upper bound also proves the candidate is optimal for the stated model; any additional real limit would require a new check.
Reading solver status
- Optimal: the solver reports the best feasible objective under its model and numerical assumptions.
- Infeasible: no values satisfy every encoded constraint.
- Unbounded: feasible objective values can improve without a finite limit.
Substitute a reported candidate into every bound and recompute the objective from the entered coefficients. If the status is unexpected, inspect units, bounds, and inequality directions before drawing a real-world conclusion.
A solver reports x = 2, y = 3 for maximize 4x + 5y subject to x + y ≤ 6, 2x + y ≤ 8, and x,y ≥ 0. Which verification is correct?
A solver is given x ≥ 5, x ≤ 3, and an objective to maximize x. It reports infeasible. What does that status mean for the entered model?