∇ProvenDecisions
Ctrl K

Tin can with the least metal: a geometric programming example, solved and checked

The tin can with the least metal is a classic geometric programming problem. Here it is solved by a real solver (CLARABEL (geometric program)) and checked: every constraint, and the optimality certificate. Change the numbers below and solve your own.

Answer. The smallest objective value is 553.581, at r = 5.41895, h = 10.8398. All 3 constraints are satisfied (largest violation 5e-05, within the solver's tolerance). Optimal, numerically checked.

Solve your own version free, no account needed

The problem

A closed cylindrical can must hold 1000 cm^3. What radius and height use the least metal (surface area)?

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 small as possible
limit 1: left side must equal 1000
radius of the can (cm) cannot be negative
height of the can (cm) cannot be negative

What is being decided

There are 2 decision variables.

VariableTypeMeaning
rreal numberradius of the can (cm)
hreal numberheight of the can (cm)

Goal and limits

Minimize the objective subject to 3 constraints, of which 2 are simple bounds on a single variable.

Problem type

Geometric program, complexity level 4: a geometric program: convex after taking logarithms of the variables, so the optimum is global. Solved with CLARABEL (geometric program) 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.

(5.41895, 10.8398)-1.084-2.1680.8131.6262.7095.424.6069.2146.50313.008rh

The answer at a glance

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

r5.41895h10.8398

Which constraints hold the answer in place

Binding (no slack left): (1) 3.141592654*h*r^2 = 1000. Changing a binding constraint changes the answer; a slack one can move a little without effect.

#ConstraintValueLimitSlackBinding
13.141592654*h*r^2 = 1000100010004.81223e-05yes
2r >= 05.4189505.41895
3h >= 010.8398010.8398

Algebraic model (low level)

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

Model code (cvxpy)

The same model in cvxpy, ready to run.

import cvxpy as cp

r = cp.Variable(name='r')  # radius of the can (cm)
h = cp.Variable(name='h')  # height of the can (cm)

objective = cp.Minimize(6.283185307179586*h*r + 6.283185307179586*r**2)
constraints = [
    3.141592653589793*h*r**2 == 1000,
    r >= 0,
    h >= 0,
]
problem = cp.Problem(objective, constraints)
problem.solve(solver='CLARABEL')
print(problem.status, problem.value)
print('r =', r.value)
print('h =', h.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).

minimize 2*3.141592653589793*r^2 + 2*3.141592653589793*r*h
subject to
3.141592653589793*r^2*h = 1000
r, h >= 0
# r = radius of the can (cm)
# h = height of the can (cm)

Change the numbers and solve it

Checked: the app's answer matches the reference answer in our test set. 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: