∇ProvenDecisions
Ctrl K

Shadow prices of a production plan: a linear programming example, solved and checked

The shadow prices of a production plan 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. You asked for: the dual problem. Shadow prices (objective change per extra unit of each limit): (1) 2*a + b <= 100: 1.33333; (2) a + 2*b <= 80: 0.333333; (3) a >= 0: 0; (4) b >= 0: 0. 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

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; 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. Write the dual problem and find the dual prices of labour and raw material.

How the model was built

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

The model

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

make this as large as possible
limit 1: left side cannot exceed 100
limit 2: left side cannot exceed 80
units of product A produced (units) cannot be negative
units of product B produced (units) cannot be negative

In matrix form

With its numbers:

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

What is being decided

There are 2 decision variables.

VariableTypeMeaning
areal numberunits of product A produced (units)
breal numberunits of product B produced (units)

Goal and limits

Maximize the objective 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 (the inequality rows) and A_eq x = b_eq (the equations); 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')  # units of product A produced (units)
b = cp.Variable(name='b')  # units of product B produced (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)

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 + b <= 100
a + 2*b <= 80
a, b >= 0
# a = units of product A produced (units)
# b = units of product B produced (units)
# asked: the dual problem

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: