You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to automate the construction of MathProgBase.
I am doing something along these lines:
matable struct MPB <: MathProgBase.AbstractNLPEvaluator end
function foo(f::Function, g!::Function, x0, lvar, uvar, sense, solver, args...)
MathProgBase.features_available(g::MPB) = [:Grad]
function MathProgBase.initialize(d::MPB, requested_features::Vector{Symbol})
for feat in requested_features
if !(feat in [:Grad])
error("Unsupported feature $feat")
end
end
end
MathProgBase.jac_structure(g::MPB) = Int[],Int[]
MathProgBase.eval_jac_g(g::MPB, J, x) = nothing
MathProgBase.eval_f(g::MPB, x) = f(x)
MathProgBase.eval_grad_f(g::MPB, gr, x) = g!(gr, x)
m = MathProgBase.NonlinearModel(solver)
MathProgBase.loadproblem!(m, length(x0), 0, lvar, uvar, Float64[], Float64[], sense, MPB())
MathProgBase.setwarmstart!(m, x0)
do_computations(m, args...)
end
The function works fails the first time with a ERROR: MethodError: no method matching features_available(::Genoud.Genoud_MPB) The applicable method may be too new: running in world age 21824, while current world is 21830.. After I run it twice everything works as expected. I know about the World count, but I was wondering how can I obviate this problem (I am running out of ideas). The alternative would be to pass the non-linear problem as an argument to foo but I would like to make this automatic.
The text was updated successfully, but these errors were encountered:
I am trying to automate the construction of MathProgBase.
I am doing something along these lines:
The function works fails the first time with a
ERROR: MethodError: no method matching features_available(::Genoud.Genoud_MPB) The applicable method may be too new: running in world age 21824, while current world is 21830.
. After I run it twice everything works as expected. I know about the World count, but I was wondering how can I obviate this problem (I am running out of ideas). The alternative would be to pass the non-linear problem as an argument tofoo
but I would like to make this automatic.The text was updated successfully, but these errors were encountered: