Jackpot numbers: what to do with a ten-year-old tool nobody can maintain
An unmaintained bridge-checking tool, forty inputs, and engineers guessing until it passes. How to turn a legacy black box into a search tool without losing anyone's trust.
· 5 min read · Erik Kubica
A friend runs a team at a mid-size civil-engineering consultancy. Over a beer he described a program his engineers use every week to check bridge designs. It takes about forty numbers (span lengths, section dimensions, material grades, load cases) and tells you whether the bridge stays inside the design code's limits.
The man who wrote it left years ago. Nobody has the source. Nobody knows exactly which formulas are inside. It still works, so everybody still uses it.
Then he described how they use it, and that was the part that stayed with me:
You put numbers in. It fails. You nudge a thickness, a spacing, a strand count. It passes, but it's too heavy. You nudge again. After an afternoon you find a set that passes and is cheap. We call those the jackpot numbers.
That's a human doing gradient-free optimisation by hand, on a black box, with a stopwatch running. It's also the most common shape of "legacy software problem" I've seen: the tool isn't broken. The workflow around it is.
What the tool probably is
We started with nothing but a description. The engineers said it calculates the bridge "as a string". In their tradition that almost certainly means a wire model: the deck is treated as a 1D beam (a line with stiffness), solved in 2D, with supports, sections, moving traffic loads, load combinations and code checks on top.
That guess turned out to be useful well before we confirmed it. It told us the problem was solvable from first principles if it had to be, and that the forty inputs probably weren't forty real design variables. Most were fixed by the project (span lengths, site, code edition). Only ten to fifteen were knobs an engineer really turns. That changes the optimisation problem completely.
The solution in one line: make it a function
The whole fix comes down to turning "an engineer and a program, guessing" into
f(params) -> results: something a script can call a thousand times a second.
That happens in three moves:
- Learn the black box from the outside. Feed it inputs, record what comes out, and change one parameter at a time. You quickly see which inputs matter, which are fixed by the project, and which formulas and code clauses the outputs must come from. You don't need the source code to understand what a calculation does. You need patience and a spreadsheet of input → output pairs.
- Rebuild the calculation as a modern engine, from the structural theory and the design code, fast enough to run inside a loop and open enough that every number can be inspected.
- Keep the old tool as the referee. Feed both the same inputs and compare. The old program stops being the product and becomes the test oracle.
The trust contract
Here's the uncomfortable truth about rewriting engineering software: nobody cares that your code is cleaner. A bridge engineer's question is "does it give the same answer as the thing I've trusted for ten years, and if not, who's right?"
So the contract is:
- The rewrite runs against the original on thousands of inputs: random ones, edge cases, and every real project the firm has archived.
- Outputs must match to a tight, stated tolerance.
- Every mismatch gets explained. Either the old tool has a bug (prove it with a closed-form case or the code clause) or the new one does (fix it).
- Until an engineer has reviewed a mismatch, the old tool's behaviour is the spec, bugs included.
That last point feels backwards to developers. It isn't. A ten-year-old tool's quirks are baked into ten years of approved designs. Silently "fixing" one is a change to engineering practice, and that's a decision for an engineer, not a refactor.
Every number has a return address
The second half of the contract is documentation. Every formula and constant we use, whether it came from a design code or from matching the old tool, gets a short entry: the expression, the units, the exact clause it came from, the line of code that uses it, and the test that checks it.
Two hundred formulas in, that log is the most valuable artefact in the project. When an engineer asks "why is this factor 1.35 and not 1.5?", the answer is one search away, with a clause number they can check against the printed standard on their desk.
From "check" to "search"
Once the calculation is a function you can call, a loop becomes possible:
for candidate in optimiser.suggest():
results = check_bridge(candidate)
optimiser.report(cost(candidate), max_utilisation(results))
Minimise cost or material, subject to every utilisation ratio staying at or below 1.0 (or a margin the engineer picks). Tools like Optuna or pymoo handle the search. On a fast engine the plan is to evaluate huge numbers of designs in the time it used to take to find one set of jackpot numbers.
The output isn't "the answer". It's a shortlist: five candidate designs, each with every check's demand, resistance and utilisation shown, sorted by cost. An engineer picks one, reviews it, and signs it. The tool searches. It never approves.
I want to be clear about that because it's where projects like this go wrong. In structural engineering, a person with a licence puts their name on the result. Software that hides its working or claims authority it doesn't have isn't helping that person. It's a liability with a nice UI.
What I'd tell anyone stuck with a black box
- Describe the workflow before the code. The pain wasn't the tool. It was the afternoon of guessing around it.
- Make it a function. Once the calculation is callable, everything else becomes possible.
- Keep the old tool as the referee for the new one.
- Treat the old behaviour as the spec until a domain expert says otherwise.
- Give every number a return address.
- Build search tools, not approval tools. The human with the licence stays in charge.
In the next posts I'll go into the engine itself (why Rust, and why "exact" beats "fast enough") and into the slightly unusual way this project is built: one developer, a handful of AI agents, and a rule that nothing happens without being written down.