2
votes

I can't get the solve time and node count of a MIP model using JuMP, with GLPK. Using Gurobi it works fine. Here is a minimum example to reproduce the error I am getting:

using JuMP
using GLPKMathProgInterface

m = Model(solver=GLPKSolverMIP())
@variable(m, x, upperbound=1)
@objective(m, Max, x) 

solve(m)

println(getsolvetime(m))

I get the error:

ERROR: MethodError: no method matching getsolvetime(::GLPKMathProgInterface.GLPKInterfaceMIP.GLPKMathProgModelMIP) Closest candidates are: getsolvetime(::JuMP.Model) at ~/.julia/v0.5/JuMP/src/JuMP.jl:205
getsolvetime(::MathProgBase.SolverInterface.LPQPtoConicBridge) at ~/.julia/v0.5/MathProgBase/src/SolverInterface/lpqp_to_conic.jl:199
getsolvetime(::Int64) at ~/.julia/v0.5/MathProgBase/src/SolverInterface/SolverInterface.jl:27
... in getsolvetime(::JuMP.Model) at ~/.julia/v0.5/JuMP/src/JuMP.jl:208

An equivalent message is shown when using the getnodecount method. I understand, from the documentation, that these functions are only available if implemented. Does this error mean they are not implemented? Is there a way to access any of this information going to the internal model?

Any directions are appreciated

Thank you.

1
That's correct, it's not implemented in GLPKMathProgInterface. If the GLPK API exposes a method to query the solve time, then it should be easy to expose through Julia. You can look at some of the other solver packages for examples.mlubin

1 Answers

1
votes

It seems that solve_time(model) is now possible.