∇ProvenDecisions
Ctrl K

Product mix problem: a linear programming example, solved and checked

The product mix problem is a classic linear programming problem. Here it is solved by a real solver (HIGHS) and checked: every constraint, the dual, and the optimality certificate. Change the numbers below and solve your own.

Answer. Assumed: products can be made in fractional amounts (the optimum is whole anyway). The largest objective value is 160, at a = 40, b = 20. All 4 constraints are satisfied exactly. Exactly proven optimal.

Solve your own version free, no account needed

Say it or snap it

You can give ProvenDecisions this problem out loud or as a photo. The app wrote down both, solved them, and got the same checked answer as the typed version.

🎙️ Spoken (24 seconds)

What the app heard: “A company makes two products, product A and product B. Each unit of product A needs two hours of labor and one unit of raw material and earns three dollars of profit. Each unit of product B needs one hour of labor and two units of raw material and earns two dollars. There are 100 labor hours and 80 units of raw material. How many units of each product should the company make to maximize profit?”

📷 Photographed
Photo of the product mix problem written on a note

The problem

A company makes products A and B. Each A needs 2 hours of labour and 1 unit of raw material and earns $3 profit; each B needs 1 hour of labour and 2 units of raw material and earns $2. There are 100 labour hours and 80 units of raw material. How many of each should it make to maximize profit?

How the model was built

The objective as written from the problem, before the numbers are multiplied out:

Assumptions:

The model

Each line has a plain-language note on the right.

make as large as possible: total profit ($)
limit 1: left side cannot exceed 100
limit 2: left side cannot exceed 80
number of product A made (units) cannot be negative
number of product B made (units) cannot be negative

In matrix form

With its numbers:

What is being decided

There are 2 decision variables.

VariableTypeMeaning
areal numbernumber of product A made (units)
breal numbernumber of product B made (units)

Goal and limits

Maximize total profit ($) subject to 4 constraints, of which 2 are simple bounds on a single variable.

Problem type

LP, complexity level 1: a small linear program. Solved with HIGHS at the Medium solver tier.

Picture

Shaded: every point that satisfies all the constraints. Dot: the optimum. Dashed: the objective's level line through it.

(40, 20)-16-2012154050688596120ab

The answer at a glance

The optimal value of each decision, as the solver returned it.

a40b20

Which constraints hold the answer in place

Binding (no slack left): (1) 2*a + b <= 100; (2) a + 2*b <= 80. Changing a binding constraint changes the answer; a slack one can move a little without effect.

#ConstraintValueLimitSlackBinding
12*a + b <= 1001001000yes
2a + 2*b <= 8080800yes
3a >= 040040
4b >= 020020

Why this is optimal

A proof you can check by hand. Multiply each constraint in the table by its weight and add them up: the result is an upper limit on the objective that holds for every plan meeting the constraints. Our answer reaches that limit exactly, so no plan does better. Every step was checked in exact fractions, not rounded decimals.

#ConstraintWeight
12·a + b ≤ 1004/3
2a + 2·b ≤ 801/3

Algebraic model (low level)

Decision variables, objective and every constraint written out; this is exactly what the solver receives.

Standard form

As a linear program: minimize cᵀx subject to A x ≤ b (and A x = b for equalities); a maximization is written as minimizing the negative.

Model code (cvxpy)

The same model in cvxpy, ready to run.

import cvxpy as cp

a = cp.Variable(name='a')  # number of product A made (units)
b = cp.Variable(name='b')  # number of product B made (units)

objective = cp.Maximize(3*a + 2*b)
constraints = [
    2*a + b <= 100,
    a + 2*b <= 80,
    a >= 0,
    b >= 0,
]
problem = cp.Problem(objective, constraints)
problem.solve(solver='HIGHS')
print(problem.status, problem.value)
print('a =', a.value)
print('b =', b.value)

The dual problem

Every constraint of the original (primal) problem gets a price, and every primal variable becomes a constraint on those prices. Strong duality: primal and dual optima are equal (160).

Dual variablePricesValue
y1price of constraint '2*a + b <= 100' (objective change per extra unit of its right-hand side)1.33333
y2price of constraint 'a + 2*b <= 80' (objective change per extra unit of its right-hand side)0.333333

Solve your own

This is the model as the app reads it. Change any number and solve it in the free box on the front page (no account needed).

maximize 3*a + 2*b
subject to
2*a + 1*b <= 100
1*a + 2*b <= 80
a, b >= 0
# a = number of product A made (units)
# b = number of product B made (units)
# objective = total profit ($)
# assume: products can be made in fractional amounts (the optimum is whole anyway)

Change the numbers and solve it

Checked: the app's answer matches the reference answer in our test set, which two solvers (HIGHS, CLARABEL) agree on. Built 2026-11-10.

Related examples

All 50 solved examples

Try ProvenDecisions free: type, photograph or say an optimization problem; every answer is checked by a solver.

What do you want to optimize?

Type the math, describe it in words, snap a photo or say it. ProvenDecisions builds the model, solves it, checks it and walks you through it.

One constraint per line, or separated by commas. Add integer: x, y or binary: z for whole-number decisions. LaTeX works too.

Try: