đ #97 Tailoring best practices of software engineering to the world of optimization
The simplest way to gain maintainability, clarity, and industrial-grade structure in your optimization software.
I first met Tim during the Advent of OR 2024.
In one of the open mic sessions we got at the advent, his clarity when talking about modeling stuck with me.
A few weeks ago, while preparing the 2025 edition, his name came back onto my radar. I had been thinking about showcasing great engineering practices inside optimization, and Timâs work on GAMSPy fit that theme perfectly.
So we reconnected.
After looking carefully to his course, it became obvious we shared the same perspective:
Optimization isnât just math, itâs software engineering.
And Tim has years of experience turning that philosophy into real, industrial-grade systems.
Thatâs why Iâm thrilled to bring him to Feasible today.
Tim Varelmann is the founder of Bluebird Optimization. Heâs a Computational Engineering Scientist trained at RWTH Aachen, the University of Queensland, MIT, and UT Austin. Heâs built optimization software for demanding environments and teaches others how to do it with clarity and structure.
His track record includes work with European brands such as Zalando and SAP, alongside a diverse set of startups â from local innovators in his home region to cutting-edge teams in Silicon Valley.
And today, heâs sharing a story every OR engineer should read.
Iâll leave you with him. âš
Software maintainability is never accidental â and when itâs neglected, complexity grows faster than your model ever will.
So if we canât get high-quality optimization software for zero effort, what if I told you that you only need to put effort into one concept (for which I built the Code-Check Compass, you can get it here) to make your model implementations robust, readable, and easy to extend?
That would be the minimal feasible effort, wouldnât it?
Letâs phrase it like an optimization problem:
min Effort
s.t. Ease of maintenance â„ 90%
Ease of extension â„ 90%
Ease of readability â„ 90%Are you ready to see the optimal solution with an objective value of âput effort into one concept onlyâ?
This concept is called: algebraic modeling.
Once you start modeling algebraically, youâll naturally reap the benefits of high-quality software.
đ§č Refactoring chaos: a personal story
Several years into my career, I joined a project that had grown into a 2,500-line tangle of optimization code. The previous team had done impressive work getting it to run at all â but without software-engineering structure, the codebase had become unmanageable: duplication everywhere, untested branches, and enough hidden bugs to keep anyone awake at night.
I had already used algebraic modeling for years, but this was the moment that proved its full power to me.
I started refactoring, applying algebraic modeling principles: reuse parameters, express logic through sets, and separate data from equations. Each step made the next easier â it was like the code began cleaning itself.
In the end, those 2,500 lines collapsed into just 48 lines across two files â more than fifty times shorter, crystal clear, and remarkably stable. Testing became trivial, bugs were eliminated, onboarding new collaborators became effortless.
That project reignited my appreciation for how algebraic modeling naturally enforces software-engineering discipline. It also inspired me to channel years of this experience into something shareable â âEffortless Modeling in Python with GAMSPyâ, the worldâs first dedicated course on GAMSPy.
Iâm still proud of that milestone. Seeing practitioners finally model with elegance and engineering rigor is one of the most rewarding parts of my work.
đ Why algebraic modeling is worth your focus
Algebraic modeling isnât just a convenient syntax. Itâs a framework that quietly enforces high-quality decisions throughout your model implementation.
Hereâs how the landscape looks:
âïž Commercial vs. open-source environments: Open-source frameworks are fantastic for experimentation, but commercial environments still lead in sparsity exploitation. They generate models faster and scale better for industrial applications â crucial when your time budget is measured in seconds, not coffee breaks.
đ Why GAMS stands out: GAMS is the original algebraic modeling language. Its long history isnât nostalgia; itâs practical advantage.
Because GAMS has had the largest and most diverse client base for decades, itâs likely seen more real-world edge cases than any competitor â and every one of those cases has sharpened its already world-class sparsity exploitation engine. The more feedback GAMS processes, the bigger its performance gap grows.đ What makes GAMSPy unique: GAMSPy brings that heritage into Python, combining GAMSâs industrial strength with Pythonâs flexibility and seamless integration of machine learning. Itâs the bridge between optimization and data-driven intelligence â and itâs closing the gap faster than any other tool.
When you adopt algebraic modeling through GAMSPy, youâre not just writing cleaner code. Youâre stepping into decades of accumulated engineering wisdom.
âš Two immediate improvements you can make
Letâs start with two things anyone with a model implementation can do right away.
âïž 1. Separate data from equations
A cornerstone of software engineering is separation of concerns: every component has exactly one purpose â and therefore only one reason to change.
In your optimization models, this means keeping data and model logic apart. Try the following exercise:
In your code, insert a visual separator (for instance, in Python: # ----------------------- ).
Above this line: define all data and assign them to named variables.
Below this line: only describe your model logic â decision variables, constraints, objectives.
capacity = 5 # data section
# -----------------------
plant_production <= capacity # model logicClosely related is the principle DRY â Donât Repeat Yourself.
DRY doesnât mean a parameter is used only once; it means each value has a single source of truth. Define capacity = 5 once, then reuse that variable wherever it belongs. If capacity changes to 7, thereâs just one line to update. Thatâs reuse instead of repetition.
đ 2. Replace manual arithmetic with set-based operators
Instead of:
total_production = prod_machine1 + prod_machine2 + prod_machine3use
machines = set(1, 2, 3)
total_production = SUM(i in machines, prod_m[i])Again, the benefit of the revised version is: in case of changes (i.e adding/removing machines), you only have to touch the set definition, but not the constraint formulation.
Algebraic Modeling Environments provide this functionality natively â defining sets, iterating over them, and correctly expanding operations such as sums over them.
I sometimes think âset-based modelingâ would be a more intuitive name than âalgebraic modeling,â because it describes whatâs really happening under the hood. But for historical reasons, the field calls it algebraic.
â¶ïž Your next step
Canât get enough of these practical hints, but donât want to dig through dozens of articles to find them?
Grab my Code-Check Compass at https://gift.bluebirdoptimization.com/feasible.
Itâs a concise, industrial-strength checklist that turns âI hope this model holds togetherâ into âI know exactly what to checkâ. Each line saves time, prevents bugs, and nudges your models toward elegance.
â Get the checklist and make your optimization models a joy to maintain.
Until the next iteration!
-Tim.










