Source-linked AI summary
JuMP 1.0: Recent improvements to a modeling language for mathematical optimization
Miles Lubin, Oscar Dowson, Joaquim Dias Garcia, Joey Huchette, Benoît Legat, Juan Pablo Vielma
TL;DR
JuMP 1.0 addresses the evolution of a Julia-embedded optimization modeling language supporting diverse problem classes and solver communication. The paper reviews user-visible improvements enabled largely by MathOptInterface, including direct modeling, compilation-latency workarounds, benchmarks, callbacks, broader constraints, and improved documentation. It also identifies direct mode’s solver and reformulation restrictions.
Problem
JuMP needs to support diverse optimization problem classes while abstracting communication with underlying solvers in a Julia environment affected by compilation latency.
Method
The paper reviews JuMP improvements through examples and discussions of direct mode, PackageCompiler.jl, benchmarks, callbacks, constraint types, and documentation.
Results
JuMP 1.0 includes user-visible improvements enabled largely by MathOptInterface and other Julia ecosystem developments, with JuMP faster than Pyomo on larger models and similar to Gurobi’s C++ interface.
Takeaways & Limitations
JuMP 1.0 broadens modeling and solver-interface capabilities while providing more robust callbacks, unified status reporting, and expanded documentation.
Takeaways & Limitations
Direct mode requires solvers supporting incremental modification, prevents changing the associated solver, and disables reformulations, particularly for conic models.
Abstract
from arXiv · showhide
JuMP is an algebraic modeling language embedded in the Julia programming language. JuMP allows users to model optimization problems of a variety of kinds, including linear programming, integer programming, conic optimization, semidefinite programming, and nonlinear programming, and handles the low-level details of communicating with solvers. After nearly 10 years in development, JuMP 1.0 was released in March, 2022. In this short communication, we highlight the improvements to JuMP from recent releases up to and including 1.0.
1 Introduction
JuMP is a Julia-embedded algebraic modeling language for diverse mathematical optimization problems. JuMP 1.0 highlights user-visible improvements enabled largely by MathOptInterface and other Julia ecosystem developments.
- JuMP supports linear, integer, conic, semidefinite, and nonlinear programming while handling communication with underlying solvers.
- More than 90% of JuMP’s code was rewritten during the transition to the MathOptInterface solver abstraction layer.
- JuMP 1.0 describes user-visible improvements made between version 0.12, released in February 2016, and version 1.0, released in March 2022.
- The paper covers syntax, direct mode, compilation latency, benchmarks, attributes, callbacks, and extensions to new problem domains and applications.
2 JuMP syntax, through example
A constrained linear-regression example demonstrates JuMP’s modeling syntax and solver workflow. The macro syntax remains broadly stable, while solver interaction changed after the transition to MathOptInterface.
- A JuMP example solves constrained linear regression with the nonlinear solver Ipopt.
- The example uses macros to create variables, add constraints, and set the objective by minimizing the sum of squared residuals.
- The solution is displayed with solution_summary(model).
- Macro syntax has not changed substantially, but the APIs for setting the solver, solving, and querying results changed between JuMP 0.18 and 0.19.
3 Direct mode
JuMP’s default mode stores a separate copy of problem data, whereas direct_model passes data directly to the solver as a stateless wrapper. Direct mode can reduce memory use and improve performance, but it restricts solver and model capabilities.
- The default JuMP mode stores its own problem-data copy, enabling model modification and solver changes.
- direct_model passes all problem data directly to the solver without intermediate caches or transformations.
- direct_model can reduce peak memory usage, improve performance, and safely interleave JuMP code with direct solver-API access.
- The example accesses HiGHS through its C API by calling Highs_scaleCol on a solver-problem pointer and column.
- Direct mode is unsuitable for solvers lacking incremental modification support, including one-shot solvers requiring all data in one call.
- In direct mode, users cannot change the model’s solver, and reformulations, especially for conic models, are disabled.
4 Compilation latency
JuMP 1.0 addresses Julia’s JIT compilation latency, which can make first-time or command-line use feel sluggish. A custom sysimage caches compiled code and reduces startup overhead for repeated model runs.
- Julia’s JIT compilation model causes noticeable latency, especially during command-line execution or a function’s first interactive invocation.
- A trivial two-variable, two-constraint linear program took 16.173 seconds when run from the command line.
- Compilation latency is independent of problem size, so its overhead may be tolerable for models requiring minutes or hours to solve.
- PackageCompiler.jl generates a custom sysimage that caches compiled code as a workaround for Julia’s compilation latency.
- 0.587 total seconds was measured with the custom image, compared with 16.173 total seconds without it.The reported command-line timing was 0.68 seconds in the surrounding text, with a measured total of 0.587 seconds in the output.
- The same sysimage can be reused after changing model.jl or running another file, with a slight performance detriment.
5 Benchmarks
JuMP 1.0 benchmarks update earlier comparisons across JuMP’s default and direct modes, Pyomo, and GRB/C++. Results remain broadly consistent with prior reports, with JuMP especially competitive on larger models.
- The benchmark suite updates a selection of results from the previous JuMP paper and measures model generation and transfer to Gurobi.
- The experiments used Julia 1.6.2, JuMP 1.0.0, Gurobi, Python 3.8, and Pyomo 6.4.0 on a 2018 MacBook Pro with 16 GB of RAM.
- JuMP is faster than Pyomo, especially on larger models, and has similar performance to Gurobi’s C++ interface.
- JuMP in direct_model is faster than GRB/C++ for the lqcp model family, likely because JuMP builds quadratic expressions more efficiently.
6 Solver attributes
JuMP 1.0’s attribute system standardizes solver configuration while allowing solver-specific extensions. This flexibility supports independent solver instances and meta-solvers that pass parameters to inner solvers.
- Solver options can be bundled with a solver constructor and changed after construction using set_optimizer_attribute.
- The flexible attribute system allows multiple independent copies of a solver with different parameter settings to be created from the same input.
- The system unifies how meta-solvers pass user parameters through to their inner solvers.
- JuMP provides solver-independent attributes such as starting points, verbosity, and time limits, while also supporting solver-specific attributes.
7 Callbacks
JuMP 1.0 revises callback support by retaining solver-independent callbacks and exposing solver-dependent callbacks through low-level solver APIs. The design addresses behavioral differences across solvers while preserving access to specialized controls.
- Earlier solver-independent callbacks behaved differently across solvers, making them closely tied to individual solver implementations and difficult for meta-solvers to use.
- JuMP 1.0 supports lazy constraint, user-cut, and heuristic callbacks for mixed-integer programming.
- Lazy constraint callbacks add constraints at branch-and-bound nodes, user cuts tighten continuous relaxations, and heuristic callbacks inject integer-feasible points.
- Low-level solver API access enables solver-dependent callbacks, such as terminating a GLPK solve when an integer-feasible solution is detected.
8 Extensions
JuMP is designed for extension through external packages, enabling new domains, syntax, and combinations of multiple models. Examples span unit-aware modeling, infinite-dimensional and stochastic optimization, power networks, and bilevel problems.
- Extensions through external packages: JuMP exposes code hooks that external packages use to extend the modeling language to new problem domains and syntax.UnitJuMP.jl adds unit information to variables and automatically scales expression terms to matching units.
- Extensions through external packages: BilevelJuMP.jl lets users formulate and solve bilevel optimization problems using JuMP’s syntax by combining multiple JuMP models.
- Extensions through external packages: Popular extensions include InfiniteOpt.jl for infinite-dimensional variables, PowerModels.jl for steady-state power networks, and SDDP.jl for multistage stochastic programming.
9 Additional improvements
JuMP 1.0 added requested model-editing, infeasibility-diagnosis, solution-query, solver-support, constraint, status-reporting, and documentation improvements. The release also broadened supported problem formulations and simplified solver installation.
- Feature improvements: JuMP 1.0 added deletion and coefficient-modification operations, IIS queries for supported solvers, and access to multiple primal solutions from mixed-integer solvers.
- Solver support: 13 to 41 supported solvers were added, alongside compatibility with AMPL- or GAMS-compatible solvers and automatically distributed binaries for open-source C/C++ solvers.Solver binaries are downloaded when wrapper packages are added through Julia’s package manager, reducing installation complaints.
- Constraint and status support: MathOptInterface enabled broader support for constraint types and user-defined constraint sets, including indicator and complementarity constraints.Indicator constraints condition an inequality on a binary variable, while complementarity constraints relate a function and a variable at a bound.
- Constraint and status support: MathOptInterface enums provide more unified, robust, and expressive reporting of primal, dual, and termination statuses.
- Documentation: Documentation now includes a broad range of how-to, reference, and tutorial materials.
Ethics declarations
The authors report funding for work contributing directly to JuMP 1.0 and declare no conflicts of interest. The article states that its analyzed data and software are publicly available or open source, with one commercial-software exception.
- Funding and conflicts: O. Dowson and B. Legat acknowledge NSF funding under grant OAC-1835443 for work directly contributing to the JuMP 1.0 release.
- Funding and conflicts: The authors declare that they have no conflict of interest.
- Data and software availability: All analyzed data are publicly available, and the authors’ software is open source except for commercial Gurobi, which is available for academic use.Specific references and URLs are included in the published article.