i have faced to this error in using GLPKMathProgInterface pkg please help me to fix that.

Failed to precompile GLPK [60bf3e95-4087-53dc-ae20-288a0d20c6a6]

# The error of using GLPKMathProgInterface pkg

Hi there!

Step 1: read PSA: make it easier to help you. In particular, please post what you have tried and the full print-out of the error.

Step 2: You should use `GLPK`

instead of `GLPKMathProgInterface`

(GLPKMathProgInterface was for an old release with JuMP). To use GLPK with JuMP 0.20, use:

```
import Pkg
Pkg.add("GLPK")
using JuMP
using GLPK
model = Model(with_optimizer(GLPK.Optimizer))
```

I use this pkg (GLPKMathProgInterface) to get dual variables of master problem in column generation method. I send my codes for you. I did the way you suggested, but I faced the same error. (Failed to precompile GLPK [60bf3e95-4087-53dc-ae20-288a0d20c6a6])

using JuMP

using GLPKMathProgInterface

W=100

cardinalityM=5

M=[1:cardinalityM]

A=eye(cardinalityM)

p=zeros(5)

w=[11; 15; 19; 23; 27]

b=[97; 140; 191; 85; 129]

@time begin # time measurement begins

cutstockMain = Model() # Model for the master problem

Jprime=[1:size(A,2)] # Intial number of variables

@defVar(cutstockMain, 0 <= x[Jprime] <= 1000000) # Defining the variables

@setObjective(cutstockMain, Min, sum{1*x[j],j in Jprime}) # Setting the objective

@addConstraint(cutstockMain, consRef[i=1:cardinalityM], sum{A[i,j]*x[j], j in Jprime}==b[i])

solve(cutstockMain)

getDual(consRef)

for i in M

p[i] = getDual(consRef)[i]

end

cutstockSub=Model() # Model for the subproblem

@defVar(cutstockSub, 0 <= Ajstar[M] <= 1000000, Int )

@setObjective(cutstockSub, Min, 1-sum{p[i]*Ajstar[i],i in M})

@addConstraint(cutstockSub, sum{w[i]*Ajstar[i], i in M} <= W)

solve(cutstockSub)

minReducedCost=getObjectiveValue(cutstockSub)

Anew=Float64

for (i in 1:cardinalityM)

push!(Anew, getValue(Ajstar)[i])

end

xNewArray=Variable

k=1

while (minReducedCost < 0)

@defVar(cutstockMain, 0 <= xNew <= 1000000, objective=1, inconstraints=consRef, coefficients=Anew)

push!(xNewArray, xNew)

setName(xNew, string(“x[”,size(A,2)+k,"]"))

k=k+1

statusControlFlow=solve(cutstockMain)

getDual(consRef)

for i in M

p[i] = getDual(consRef)[i]

end

@defVar(cutstockSub, 0 <= Ajstar[M] <= 1000000, Int )

@setObjective(cutstockSub, Min, 1-sum{p[i]*Ajstar[i],i in M})

@addConstraint(cutstockSub, sum{w[i]*Ajstar[i], i in M} <= W)

solve(cutstockSub)

minReducedCost=getObjectiveValue(cutstockSub)

Anew=Float64

for (i in 1:cardinalityM)

push!(Anew, getValue(Ajstar)[i])

end

end

```
end
println("Objective value: ", getObjectiveValue(cutstockMain))
println("Current Solution is: ", getValue(x))
println("With ", length(xNewArray), " variables added by flow control:")
for i in 1:length(xNewArray)
println("[",size(A,2)+i,"] = ",getValue(xNewArray[i]))
end
println("Reduced cost of the current solution is ", getObjectiveValue(cutstockSub))
```

A few things:

- You’re using a very old version of JuMP.

- You should consult the documentation: https://www.juliaopt.org/JuMP.jl/stable/
- There are also lots of examples: https://github.com/JuliaOpt/JuMP.jl/tree/v0.20.1/examples.
- I recommend you start with the Quickstart Guide, which shows how to use GLPK.

- Take another read of the PSA.

- In particular, point 1 describes how to format your code.
- Point 4 is also important: simplify your code as much as possible. Try to reduce it to the minimum amount of code necessary to reproduce the error.