Julia 如何使用JuMP/GLPK获得求解时间

Julia 如何使用JuMP/GLPK获得求解时间,julia,julia-jump,Julia,Julia Jump,我无法使用JuMP和GLPK获得MIP模型的解算时间和节点计数。使用古罗比,效果很好。下面是一个再现我得到的错误的最小示例: using JuMP using GLPKMathProgInterface m = Model(solver=GLPKSolverMIP()) @variable(m, x, upperbound=1) @objective(m, Max, x) solve(m) println(getsolvetime(m)) 我得到一个错误: 错误:MethodError

我无法使用JuMP和GLPK获得MIP模型的解算时间和节点计数。使用古罗比,效果很好。下面是一个再现我得到的错误的最小示例:

using JuMP
using GLPKMathProgInterface

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

solve(m)

println(getsolvetime(m))
我得到一个错误:

错误:MethodError:没有与getsolvetime匹配的方法(::GLPKMathProgInterface.GLPKInterfaceMIP.GLPKMathProgModelMIP) 最接近的候选项是:getsolvetime(::JuMP.Model)at ~/.julia/v0.5/JuMP/src/JuMP.jl:205
getsolvetime(::MathProgBase.SolverInterface.LPQPtoConicBridge)位于 ~/.julia/v0.5/MathProgBase/src/SolverInterface/lpqp\u to\u conic.jl:199
getsolvetime(::Int64)位于 ~/.julia/v0.5/MathProgBase/src/SolverInterface/SolverInterface.jl:27
... 在的getsolvetime(::JuMP.Model)中 ~/.julia/v0.5/JuMP/src/JuMP.jl:208

当使用getnodecount方法时,将显示一条等效消息。我从文档中了解到,这些功能只有在实现后才可用。这个错误是否意味着它们没有实现?有没有办法访问内部模型中的这些信息

如有任何指示,不胜感激


多谢各位

似乎
求解时间(模型)
现在是可能的。

没错,它没有在GLPKMathProgInterface中实现。如果GLPK API公开了一个查询求解时间的方法,那么通过Julia公开应该很容易。您可以查看其他一些解算器包以获取示例。