Hi, just wondering if there is a way to ‘extract’ the canonical matricial(*) LP form from a JuMP model.
(*) With canonical form I meant something like:
\text{maximize } c^Tv \text{, subject to:} \\
Sv = b \\
lb \le v \le ub
Example
import JuMP, GLPK
# Parameters
M, N = 8, 10
S, b = rand(M, N), rand(M)
lb, ub = -rand(N), rand(N)
c = zeros(N); c[end] = 1.0
sense = JuMP.MOI.MAX_SENSE
# JuMP
model = JuMP.Model(GLPK.Optimizer)
JuMP.@variable(model, x[1:N])
JuMP.@constraint(model, S * x .== b)
JuMP.@constraint(model, x .>= lb)
JuMP.@constraint(model, x .<= ub)
JuMP.@objective(model, sense, c' * x)
I need to recover S, b, lb, ub and c, or something like it,
so that I can feed other engine starting from a JuMP model
already buit:
Otherwise, there is some non-public code in JuMP that does this, but note that the functions are not exported, and they may be removed or changed in any future release.
As @odow said, that is one of the aims of MatrixOptInterface, however it is not ready yet. The opposite direction is working more smoothly now.
Let us know if you are willing to contribute!