JuliaCon 2023

MathOpt: solver independent modeling in Google's OR-Tools
2023-07-28 , 32-155

Google Optimization Tools (a.k.a., OR-Tools) is an open-source, fast and portable software suite for solving combinatorial optimization problems. In this talk, we present our work on a new interface to OR-Tools, and we describe the lessons that we learnt along the way.


This talk introduces MathOpt, a software tool for modeling mathematical optimization problems (e.g. linear programs). MathOpt is part of Google's open source project OR-Tools and is used extensively within Google. MathOpt consists of three parts: (1) client libraries in various programming languages (including C++, Java and Python) to formulate a model, independently of any underlying solver, (2) an efficient, language independent data format for models, model updates and solutions, and (3) a core library to solve models in this data format with existing commercial and open source optimization solvers (e.g. Gurobi, GLOP). MathOpt provides solver independent support for a range of advanced features, including nonlinear constraints, duality, rays, LP basis, callbacks, and solver parameters. The core library of MathOpt (and the C++ client) are written in portable C++ and can run on servers, mobile devices, or even in the browser via WASM. MathOpt supports remote execution for all features (including callbacks) via RPC. For non-C++ languages, each client library is written entirely in that language, so users relying on remote solve do not require any native dependency to install and run MathOpt. We provide benchmarks showing that the overhead introduced by MathOpt is in most cases negligible.