∇ProvenDecisions
Ctrl K

From plain English to a proven answer: turning a food-truck decision into a linear program

Articles · 2026-11-25

From plain English to a proven answer: turning a food-truck decision into a linear program

Solving an optimization problem is the easy part. Solvers such as HiGHS do it in milliseconds. The hard part comes first: turning a messy, everyday description into math. That skill is rare. Most people who face a real decision (what to make, what to charge, how to split their time) can describe it clearly but could not write it as a model.

This article walks through one plain-English decision, shows the model it becomes, lists every assumption that had to be made along the way, and then solves and checks it in Python.

The decision, in the owner's words

I run a food truck that sells tacos for $4 and burritos for $7. I can make about 300 items on a Saturday and have $600 to spend on ingredients. Tacos cost me $1.50 each to make and burritos $3. What should I make to earn the most?

There is no equation in that. But it already holds everything a model needs, once a few gaps are filled in.

What had to be assumed

A description in everyday words always leaves something open. Here, three details had to be chosen before any math could be written:

Writing these down matters as much as the answer. If one of them is wrong for your truck, the answer can change, and you can only notice that if the assumptions are on the page.

The model

Solving it in Python

import cvxpy as cp

t = cp.Variable(nonneg=True)   # tacos to make
b = cp.Variable(nonneg=True)   # burritos to make

profit = (4 - 1.5) * t + (7 - 3) * b          # $ per taco and per burrito, after ingredients
limits = [
    t + b <= 300,                              # about 300 items on a Saturday: read as at most 300
    1.5 * t + 3 * b <= 600,                    # $600 ingredient budget
]
prob = cp.Problem(cp.Maximize(profit), limits)
prob.solve(solver=cp.HIGHS)

print(prob.status, round(prob.value, 6))
print("tacos", round(t.value, 6), "burritos", round(b.value, 6))
print("worth of one more item:", round(limits[0].dual_value, 6), " of one more $ of budget:", round(limits[1].dual_value, 6))

Output (cvxpy 1.9.3, HiGHS):

optimal 900.0
tacos 200.0 burritos 100.0
worth of one more item: 1.0  of one more $ of budget: 1.0

Make 200 tacos and 100 burritos, for $900 of profit. Both limits are used up exactly: 200 + 100 = 300 items, and $300 + $300 = $600 of ingredients.

Checking the answer

"Optimal" from a solver is a claim. Two checks turn it into a proof:

  1. Every limit holds at the plan: 300 ≤ 300 items and $600 ≤ $600 of ingredients.
  2. No better plan exists. The dual values (the last line of the output) say one more item of capacity is worth $1 of profit, and one more dollar of budget is worth $1. Multiply each limit by its value and add: 1 × (t + b ≤ 300) plus 1 × (1.5t + 3b ≤ 600) gives 2.5t + 4b ≤ 900. That is exactly the profit, so no plan can earn more than $900, and ours earns $900.

Change one assumption, get a different answer

Suppose only 80 burritos sell on a typical Saturday. Add that one limit (b ≤ 80) and solve again: HiGHS reports optimal, 220 tacos and 80 burritos, for $870. A $30 difference from one line of the description. This is why the assumptions belong next to the answer, not hidden inside the model.

Takeaway

I build ProvenDecisions, a web app that does this translation for you: describe a decision in everyday words, and it writes the model, lists what it assumed, solves it with a real solver and checks the answer. You can change any assumption and solve again.

This article was written with AI assistance; every number in it comes from the solver run shown above.

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: