4
votes

How do I deal with sparse matrices in JuMP?

For example, suppose I want to impose a constrain of the form:

A * x == 0

where A is a sparse matrix and x a vector of variables. I assume that the sparsity of A could be exploited to make the optimization faster. How can I take advantage of this in JuMP?

1

1 Answers

3
votes

JuMP already benefits from sparse matrix in different ways, I've not checked the source but refer to a cited paper from JuMP.jl:

In the case of LP, the input data structures are the vectors c and b and the matrix A in sparse format, and the routines to generate these data structures are called matrix generators

One point to note is that, the main task of algebraic modeling languages (AMLs) like JuMP is to generate input data structures for solvers. AMLs like JuMP do not solve generated problems themselves but they call standard appropriate solvers to do the task.