# Access JuMP canonical matricial LP problem

**URL:** <https://discourse.julialang.org/t/access-jump-canonical-matricial-lp-problem/53688>\
**Category:** Optimization (Mathematical)\
**Created:** [January 20, 2021, 10:01pm UTC](https://discourse.julialang.org/t/access-jump-canonical-matricial-lp-problem/53688 "2021-01-20T22:01:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![josePereiro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josepereiro/32/17322_2.png) [@josePereiro](https://discourse.julialang.org/u/josePereiro)\
**Post date:** [January 20, 2021, 10:01pm UTC](https://discourse.julialang.org/t/access-jump-canonical-matricial-lp-problem/53688/1 "2021-01-20T22:01:45Z")

</div>

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

```julia
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:

Thanks in advance!!

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [January 20, 2021, 11:10pm UTC](https://discourse.julialang.org/t/access-jump-canonical-matricial-lp-problem/53688/2 "2021-01-20T23:10:06Z")

</div>

JuMP does not store the problem in a canonicalized matrix form, so this is not straight-forward.

You may be able to use [https://github.com/jump-dev/MatrixOptInterface.jl](https://github.com/jump-dev/MatrixOptInterface.jl), but it is still in development and not registered. @joaquimg might be able to provide more information as to the current status.

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.

> <https://github.com/jump-dev/JuMP.jl/blob/24d131610ff51a8187352e9a55df093ce1e4b6bb/src/lp_sensitivity2.jl#L301-L410>

---

<div class="post-metadata">

**Author:** ![joaquimg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joaquimg/32/223_2.png) [@joaquimg](https://discourse.julialang.org/u/joaquimg)\
**Post date:** [January 21, 2021, 2:28am UTC](https://discourse.julialang.org/t/access-jump-canonical-matricial-lp-problem/53688/3 "2021-01-21T02:28:05Z")

</div>

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!
