When ML + optimization first shook hands


Hello Reader!

Every Superhero Has an Origin Story

For GAMSPy’s machine learning superpowers, that story begins with a package called OMLT.

OMLT is short for Optimization and Machine Learning Toolkit. It’s a package that extends Pyomo to integrate machine learning models directly into optimization problems. Because OMLT supports ONNX interoperability, you can take a model trained in TensorFlow, Keras, or PyTorch and embed it into a Pyomo optimization model.

It also happens to be the package that inspired the GAMSPy developers to integrate ML support natively into GAMSPy.

At the same time, OMLT depends on the Pyomo ecosystem. That meant it carried some of Pyomo’s baggage—most notably, the lack of advanced sparsity exploitation. By making ML integration a native feature and combining it with GAMSPy’s solver-level strengths, it eliminated those fragilities. In a way, OMLT wrote the first chapter, but GAMSPy delivers the finished story.

When the Specific Application Feels Unclear

On paper, combining ML and optimization sounds amazing. Who wouldn’t want predictive power and optimal decisions in the same place?

But if you’ve ever actually tried, you’ll know the feeling: the idea is inspiring, but the specifics of “how” and "for what" quickly become blurry.

The Bridge Builders

That is why OMLT wasn’t born in a single eureka moment.
It grew slowly, almost casually, out of group conversations:
“what if we could bring these two worlds together?”

On one side were optimization researchers with their equations — structured, interpretable, rigorous.
On the other side, machine learning researchers had flexible models that could predict almost anything, but often as opaque black boxes.

Both were powerful, but they didn’t talk to each other.

So the group of authors of OMLT started experimenting. Step by step, those “what if” discussions turned into code. That code became OMLT: a bridge that let ML models live inside Pyomo optimization problems.

And it inspired a new generation of tools — among them some features of GAMSPy.

From Idea to Impact

So what did OMLT actually make possible? Here are a few striking examples:

  • Molecule discovery: Embedding ML predictors inside optimization models to search for molecules with specific odors, such as banana or garlic.
  • Sustainable solar panels: Minimizing water and energy consumption during PV panel production.
  • Smarter energy systems: Designing electrical microgrids that don’t just balance supply and demand, but also account for how big market players can influence price formation.

And on the more methodical side: OMLT made physics-informed neural networks far easier. Instead of forcing physical laws into the structure of a neural network, you simply state them as constraints in the optimization model. They’re enforced exactly, without approximation.

Where Would You Start?

OMLT was the prequel for GAMSPy. If you wrote the prequel for ML + optimization in your own work, what would it look like?

Until the next iteration!

Tim Varelmann

​Bluebird Optimization​

Complicated Decisions - Simply Automated!

Follow me on LinkedIn​

​

P.S.: If you’re curious how ML + optimization could be combined in your field, that’s exactly the kind of development work I do for clients. Let's have a chat about it!

Bluebird Briefings

I write about my everyday life as optimization expert, where I translate business requirements to mathematical formulars, then to software -- and all the way back again.

Read more from Bluebird Briefings
From a central Logo, 3 lines leave in all directions pointing to labelled icons describing aspects of optimization under uncertainty

Hello Reader! For a little while, Trevor Miles and I turned our tiny corner of the internet back into a place of productive, civil debate. Remember the early days of social media? No algorithm decided what you saw. You saw what the people you followed posted. And the content had more depth. Trevor and I brought that back, quite organically. From an intriguing metaphor to a full debate I saw a post from Trevor that put AI into Daniel Kahneman’s famous framework of System 1 and System 2. The...

three letters in a row, each with a dollar sign at the bottom-right

Hello Reader! Who profits when nobody checks? I've been asking myself that since an envelope landed in my mailbox, and the answer applies to far more than my mail. The Solver Always Does What You Pay It For When a client's model returns a strange plan, people often suspect a bug. Sometimes it is one. More often, the solver did exactly what the objective told it to do. If the objective rewards low cost and nothing else, the solver will happily run the inventory down to zero, keep one machine...

Two football players pushing each other at arms length

Hello Reader! Right now, across the United States, Canada and Mexico, millions of people are behaving in ways they would never admit to at the office. Norwegian fans are rowing on an escalator like it's an Olympic final. Dutch fans are doing 'naar links naar rechts' in the street, a whole crowd swaying left, then right, as one. Egyptian fans are dancing through the streets of Vancouver after Egypt's first ever World Cup win, Mo Salah and the whole squad right there with them. This is the...