Wize Algebra Textbook > Linear Programming

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 ≤\leq, 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+3B7A+3B subject to 2A+B≤142A+B\leq14 and A,B≥0A,B\geq0.


The candidate A=7,B=0A=7, B=0 uses 14 hours and earns 49 credits, so it is feasible. For this simple model, 7A+3B≤(7/2)(2A+B)≤497A+3B\leq(7/2)(2A+B)\leq49, because B≥0B\geq0. 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 linear-programming solver uses x and y for units of two products. Each x uses 3 kg of material, each y uses 2 kg, and at most 18 kg is available. Which input expresses this material limit?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

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?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

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?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors