What happens when a (sparse) csr matrix / array is submitted to Gurobi (via Cvxpy framework in python).

Does it exploit the sparsity Information about the matrix or does everything gets converted to standard matrix / array?

Secondly, is there any drawback (especially in exploiting sparsity information), when calling Gurobi through Python vs calling through Matlab?

  • $\begingroup$ Drawbacks I do not know as I don't use matlab, but there is at least one good reason to use Python: it is free. $\endgroup$
    – Kuifje
    Commented Sep 23, 2022 at 15:46
  • 2
    $\begingroup$ All the major optimization software packages only deals with sparse data. $\endgroup$ Commented Sep 23, 2022 at 16:33
  • $\begingroup$ Gurobipy doesn't know about scipy.sparse.csr (last time i checked) and therefore what counts is whats happening in the wrapper code. There are lots of potential approaches (e.g. a low-level standard-form like wrapping vs. modelling-language like wrapping), but sparsity will always be respected (as 99.9% of use-cases won't do without). As cvxpy is open-source you can check the wrappers yourself. | As for python vs. matlab: python probably won't be worse / less efficient as it's commonly seen as the most FFI-friendly language (opposed to Java for example where zero-copy interfaces are hard). $\endgroup$
    – sascha
    Commented Sep 24, 2022 at 17:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.