Is it possible to obtain the basis matrix?

389 views
Skip to first unread message

Fernando Banez-Chicharro

unread,
Mar 14, 2016, 11:43:38 AM3/14/16
to julia-opt
Hi everyone!
I am starting with Julia/JuMP. I was wondering, is it possible to obtain the basis matrix of a LP problem? Or better the inverse of the basis matrix? (I am not sure if this is given by the solver).

Thanks!

Joey Huchette

unread,
Mar 14, 2016, 1:40:02 PM3/14/16
to julia-opt

This will depend on the solver you’re using: in principle, anything accessible via their C API is available in julia/JuMP with a little code. To get the basis indices (active constraints and bounds), there’s a getbasis function in MathProgBase that you can use. Right now Clp, Gurobi, Mosek, and CPLEX have this wrapped. You can call it with something like MathProgBase.getbasis(getInternalModel(model)).

-Joey


--
You received this message because you are subscribed to the Google Groups "julia-opt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to julia-opt+...@googlegroups.com.
Visit this group at https://groups.google.com/group/julia-opt.
For more options, visit https://groups.google.com/d/optout.

Fernando Banez-Chicharro

unread,
Mar 15, 2016, 11:41:23 AM3/15/16
to julia-opt, huch...@mit.edu
Thank you!

Fernando Banez-Chicharro

unread,
Apr 18, 2016, 3:46:24 PM4/18/16
to julia-opt, huch...@mit.edu
I was able to do what you said.
Do you know how can I obtain the coefficients of the variables in the constrains? I want to build the basis (and non-basis) matrix to do some sensitivity analysis. 
Or maybe it is easier to build these matrixes using the input parameters of the model. I guess I can translate the basis and non-basis variables from the "internal model" to the names I use. 
What do you think?
 
Thank you very much for your help!

Miles Lubin

unread,
Apr 18, 2016, 3:51:40 PM4/18/16
to julia-opt, huch...@mit.edu
http://mathprogbasejl.readthedocs.org/en/latest/lpqcqp.html#getconstrmatrix

MathProgBase.getconstrmatrix(getInternalModel(model))

The rows and columns correspond to the result of getbasis, so it will take a single line of code to get the basis matrix.

Fernando Banez-Chicharro

unread,
Apr 18, 2016, 3:55:52 PM4/18/16
to julia-opt, huch...@mit.edu
Great! 
I did not see that! (I was looking in Gurobi.jl)
Much better. Thanks!
Reply all
Reply to author
Forward
0 new messages