Hongyu
Hongyu

Reputation: 183

Retrieve constraints matrix from Gurobi or MOI or JuMP in Julia

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.

Upvotes: 4

Views: 406

Answers (1)

Oscar Dowson
Oscar Dowson

Reputation: 2574

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

Upvotes: 0

Related Questions