Hey Guys!

When I model a LP with JuMP, is it possible get the problem data in the form min (c^t)x s.t. Ax = b, x >= 0 easily ? I mean, with a function already existing?

If not, what is an easy way?

Thanks in advance,

Hey Guys!

When I model a LP with JuMP, is it possible get the problem data in the form min (c^t)x s.t. Ax = b, x >= 0 easily ? I mean, with a function already existing?

If not, what is an easy way?

Thanks in advance,

You can get the problem data (in a slightly different form as \min_x c^Tx such that l \leq Ax \leq u and xlb \leq x \leq xub) from the MathProgBase layer. See this example, where you can get it from the JuMP model `mod`

with something like

```
JuMP.build(mod)
m_internal = JuMP.internalmodel(mod)
c = MathProgBase.getobj(m_internal)
A = MathProgBase.getconstrmatrix(m_internal)
m, n = size(A)
xlb = MathProgBase.getvarLB(m_internal)
xub = MathProgBase.getvarUB(m_internal)
l = MathProgBase.getconstrLB(m_internal)
u = MathProgBase.getconstrUB(m_internal)
vtypes = MathProgBase.getvartype(m_internal)
```

Thanks Joey, but I need to preserve the form for duality reasons…

Maybe this could be a good functionality for JuMP: deliver the problems in

diferent equivalent formats…

Transforming between different formats is part of the game if you’re working with LPs. JuMP won’t do this for you, but we’re happy to collect code examples for future reference.