JuliaCon 2022 (Times are UTC)

SparseVariables - Efficient sparse modelling with JuMP
2022-07-27 , JuMP

Industry scale optimization problems are often large and sparse, and problem construction time can rival solution time. The default containers and macros in JuMP present some challenges for this class of problems, in particular some performance gotchas.

We present SparseVariables.jl for simple sparse modelling, and demonstrate performance and conciseness with a supply chain optimization example, benchmarking both problem construction time and LOC for multiple modelling approaches.


Motivation

Industry scale optimization problems, e.g. in supply chain management or energy systems modeling often involve constructing and solving very large, very sparse linear programs. For such problems problem construction time can rival solution time when the problem is solved by very efficient commercial linear programming solvers.

Julia and JuMP provide an elegant and fun modelling environment which integrates nicely with data management, versioning, reproducibility and portability.

The default containers and macros in JuMP do present some challenges for this class of problems, related to performance gotchas and incremental variable construction.

What it is

Thanks to the unique hackability of Julia and JuMP, it has been straight-forward to create custom containers and macros to investigate alternative approaches to modelling large sparse systems with JuMP.

We present SparseVariables which provides a nice and compact syntax for these problems with good performance by default.

Performance

To demonstrate SparseVariables, we present a demo supply chain optimization problem, which may be modelled in multiple ways, and benchmark the problem construction time and the number of lines of code for each approach.

Elegance

With SparseVariables we avoid the boiler-plate necessary with suggested work-arounds for performance issues in JuMP, and also allow incremental construction of variables, which is useful for modular modelling code. Our container features slicing and other variable selection methods to allow for short and concise code, leveraging JuMP, MathOptInterface and the Julia package ecosystem.

Lars Hellemo is a Senior Research Scientist at SINTEF, working on optimization and decision support, mainly in the energy and health care sectors.