Table of Contents
Fetching ...

PyOptInterface: Design and implementation of an efficient modeling language for mathematical optimization

Yue Yang, Chenhui Lin, Luo Xu, Wenchuan Wu

TL;DR

PyOptInterface tackles the overhead of Python-based optimization modeling by introducing BIPUR, a bitmap-based mapping that yields $O(1)$ amortized time for adding, deleting, and indexing entities, while reducing per-entity memory compared to array-based mappings. The system is implemented as a C++ core with Python bindings, supporting multiple optimizers (e.g., Gurobi, COPT, Mosek, HiGHS) and offering an optimizer-agnostic interface plus a Python-based SOC reformulation pathway. Empirical benchmarks show PyOptInterface is competitive with or faster than existing Python modeling tools and approaches JuMP in performance, particularly on larger models. This design enables scalable, efficient model construction in Python for diverse solver backends, with open-source availability for adoption and extension.

Abstract

This paper introduces the design and implementation of PyOptInterface, a modeling language for mathematical optimization embedded in Python programming language. PyOptInterface uses lightweight and compact data structure to bridge high-level entities in optimization models like variables and constraints to internal indices of optimizers efficiently. It supports a variety of optimization solvers and a range of common problem classes. We provide benchmarks to exhibit the competitive performance of PyOptInterface compared with other state-of-the-art modeling languages.

PyOptInterface: Design and implementation of an efficient modeling language for mathematical optimization

TL;DR

PyOptInterface tackles the overhead of Python-based optimization modeling by introducing BIPUR, a bitmap-based mapping that yields amortized time for adding, deleting, and indexing entities, while reducing per-entity memory compared to array-based mappings. The system is implemented as a C++ core with Python bindings, supporting multiple optimizers (e.g., Gurobi, COPT, Mosek, HiGHS) and offering an optimizer-agnostic interface plus a Python-based SOC reformulation pathway. Empirical benchmarks show PyOptInterface is competitive with or faster than existing Python modeling tools and approaches JuMP in performance, particularly on larger models. This design enables scalable, efficient model construction in Python for diverse solver backends, with open-source availability for adoption and extension.

Abstract

This paper introduces the design and implementation of PyOptInterface, a modeling language for mathematical optimization embedded in Python programming language. PyOptInterface uses lightweight and compact data structure to bridge high-level entities in optimization models like variables and constraints to internal indices of optimizers efficiently. It supports a variety of optimization solvers and a range of common problem classes. We provide benchmarks to exhibit the competitive performance of PyOptInterface compared with other state-of-the-art modeling languages.
Paper Structure (4 sections, 1 equation, 5 tables, 1 algorithm)