MathOptAI.jl: Embed Trained Machine-Learning Predictors into JuMP Models
Abstract
We present MathOptAI.jl, an open-source Julia library for embedding trained machine-learning predictors into a JuMP model. MathOptAI.jl can embed a wide variety of neural networks, decision trees, and Gaussian Processes into a larger mathematical optimization model. MathOptAI.jl supports a range of Julia-based machine-learning libraries such as Lux.jl and Flux.jl. In addition, MathOptAI.jl uses Julia’s Python interface to provide support for PyTorch models. When the PyTorch support is combined with MathOptAI.jl’s gray-box formulation, the function, Jacobian, and Hessian evaluations associated with the PyTorch model are offloaded to the GPU in Python, whereas the rest of the nonlinear oracles are evaluated on the CPU in Julia.
History: Accepted by Ted Ralphs, Area Editor for Software Tools.
Funding: Funding was provided by the Los Alamos National Laboratory LDRD program as part of the Artimis project (approved for unlimited release: LA-UR-25-24963).
Supplemental Material: The software that supports the findings of this study is available within the paper and its Supplemental Information (https://pubsonline.informs.org/doi/suppl/10.1287/ijoc.2025.1446) as well as from the IJOC GitHub software repository (https://github.com/INFORMSJoC/2025.1446). The complete IJOC Software and Data Repository is available at https://informsjoc.github.io/.

