4

I want to retrieve an LP model in matrix form from Gurobi. I am using package JuMP in Julia. I can print all the constraints using MathOptInterface but not in matrix form. I have no idea how to print the problem matrix from Gurobi. Could anyone help with this? Thanks very much in advance!

Kind regards,

Hongyu.

Hongyu
  • 183
  • 5

1 Answers1

0

To clarify, do you want the A matrix? What do you need this for? JuMP doesn't have support for this because. You would need to convert all of the MOI constraints into a matrix.

You could try JuMP._standard_form_matrix(model), but note that this is using some internal JuMP code (functions beginning with _) so this might break in any future release. Here's the code if you want to write it yourself:

https://github.com/jump-dev/JuMP.jl/blob/a8488a21140e3e3d5372d31b8c0a2788d7ac1a97/src/lp_sensitivity2.jl#L302-L350

Oscar Dowson
  • 2,395
  • 1
  • 5
  • 13
  • Thanks Oscar for your help. The reason to retrieve matrix A is that we are having a numerical issue when solving a simple LP model that is a part of an enhanced Benders decomposition. We are adding cuts to an LP model which is not the reduced master problem. Based on some initial observation of the JuMP constraints, our guess is that there is a column that all the values are next to 0 and maybe some constraints have similar coefficients. This may lead to ill condition and numerical issues. So the first step we try to do is to see what the matrix looks like. I hope that makes sense to you? – Hongyu Mar 02 '22 at 22:32