EuroSciPy 2024

Optimagic: Can we unify Python's numerical optimization ecosystem?
2024-08-29 , Room 7

Python has many high quality optimization algorithms but they are scattered across many different packages. Switching between packages is cumbersome and time consuming. Other languages are ahead of Python in this respect. For example, Optimization.jl provides a unified interface to more than 100 optimization algorithms and is widely accepted as a standard interface for optimization in Julia.

In this talk, we take stock of the existing optimization ecosystem in Python and analyze pain points and reasons why no single package has emerged as a standard so far. We use these findings to derive desirable features a Python optimization package would need to unify the ecosystem.

We then present optimagic, a NumFocus affiliated Project with the goal of unifying the Python optimization ecosystem. Optimagic provides a common interface to optimization algorithms from scipy, NlOpt, pygmo, and many other libraries. The minimize function feels familiar to users of scipy.optimize who are looking for a more extensive set of
supported optimizers. Advanced users can use optional arguments to configure every aspect of the optimization, create a persistent log file, turn local optimizers global with a multistart framework, and more.

Finally, we discuss an ambitious roadmap for improvements, new features, and planned community activities for optimagic.


Numerical optimization is a large field with applications in engineering, statistics, data science, and many other disciplines. The fundamental goal is always the same: Find a set of parameters that makes a number large or small (potentially fulfilling some constraints). Unfortunately, no single algorithm exists that can solve all optimization problems. Therefore, doing optimization in practice usually involves a lot of trial and error until one finds an optimizer that works well for specific problem characteristics.

The good news is that many high-quality optimization algorithms are implemented in Python or have Python bindings. The bad news is that they are scattered across many different packages. Switching between packages is expensive, as each package has its own way of specifying
problems and calling optimizers.

Other languages are ahead of Python in this respect. For example,
Optimization.jl provides a unified interface to more than 100 optimization algorithms and is widely accepted as a standard interface for optimization in Julia.

In this talk, we take stock of the existing optimization ecosystem in Python and analyze pain points and reasons why no single package has emerged as a standard so far. We use these findings to derive desirable features a Python optimization package would need to unify the ecosystem.

We then present optimagic, a NumFocus affiliated Project with the goal of unifying the Python optimization ecosystem. Optimagic provides a common interface to optimization algorithms from scipy, NlOpt, pygmo, and many other libraries. The minimize function feels familiar to users of scipy.optimize who are looking for a more extensive set of
supported optimizers. Advanced users can use optional arguments to configure every aspect of the optimization, create a persistent log file, turn local optimizers global with a multistart framework, and more.

Finally, we discuss an ambitious roadmap for improvements, new features, and planned community activities for optimagic.


Category [Community, Education, and Outreach]:

Learning and Teaching Scientific Python

Expected audience expertise: Domain:

none

Expected audience expertise: Python:

some

Project Homepage / Git:

https://github.com/OpenSourceEconomics/estimagic

Abstract as a tweet:

Can we unify Python's numerical optimization ecosystem with @optimagic? Join @JanosGabler when he discusses this question at #EuroScipy24 and shares an exciting roadmap for optimagic's future.

Author of optimagic / estimagic | Senior AI Researcher at appliedAI | Expert in numerical optimization | Building Bandsaws, Pizza Ovens and Furniture

This speaker also appears in: