# Linprog and Clp under JuMP or MathOptInterface - Why is it so hard?

Julia is working beautifully on an LP problem on my mac.

My optimisation problem is structured with inequality constraints and the sense vector:

sol = linprog(-f,A,sense,b,lb,ub,ClpSolver())

For some reason running the same code on Windows 10, I get an error:

`ClpSolver` is no longer supported. If you are using JuMP, upgrade to the latest version and use `Clp.Optimizer` instead. If you are using MathProgBase (e.g., via `lingprog`), you will need to upgrade to MathOptInterface (https://github.com/JuliaOpt/MathOptInterface.jl).

Is there a simple way to take these matrices and get them to work under either of the options referred to in the error, using the matrices and vectors I have already created. I have spent the entire morning reading docs for this and am just confused. Some donâ€™t use the sense vector, others I just donâ€™t understand.

There must be a simple way to â€śupgradeâ€ť this previously working code, keeping it simple?

The support for MathProgBase was just dropped in v0.8 that was released 16 hours ago. I guess you were using Clp.jl v0.7.2 on your mac.
The recommendation is to use JuMP now instead of `linprog`. From the input of `linprog`, you can do

``````using JuMP, Clp
model = Model(Clp.Optimizer)
@variable(model, lb[i] <= x[i=1:length(lb)] <= ub[i])
@objective(model, Max, f'x)
# Depending on the `sense` vector, you may need to split it into `<=` and `>=` constraints too
@constraint(model, A * x .== b)
optimize!(model)
``````
3 Likes

Thatâ€™s great, thank you. Looks like my timing was perfect for learning LP in Julia.

I assume by â€śsplittingâ€ť you mean I need two lines:

``````@constraint(model, A * x .<= b) #inequality constraints
@constraint(model, Aeq * x .== beq) #equality constraints

``````

Where beq is just a vector of zeros, right?

The first line seems to process fine, but when Julia gets to the second one I get the following errorâ€¦

julia> @constraint(model, Aeq * x .== beq)
ERROR: MethodError: no method matching zero(::Type{Any})

EDIT: Ahhh. Nevermind, my Aeq was Array{Any,2}.

Fixed with Float64.(Aeq)

Thanks again, much appreciated!