I have noticed this that appears as a type instability in AbstractNonlinearModel. Specifically, using the HS071() problem in the test directory
function nlptest(solver=MathProgBase.defaultNLPsolver)
m = MathProgBase.NonlinearModel(solver)
l = [1,1,1,1]
u = [5,5,5,5]
lb = [25, 40]
ub = [Inf, 40]
MathProgBase.loadproblem!(m, 4, 2, l, u, lb, ub, :Min, HS071())
MathProgBase.setwarmstart!(m,[1,5,5,1])
MathProgBase.optimize!(m)
stat = MathProgBase.status(m)
@test stat == :Optimal
x = MathProgBase.getsolution(m)
@test_approx_eq_eps x[1] 1.0000000000000000 1e-5
@test_approx_eq_eps x[2] 4.7429996418092970 1e-5
@test_approx_eq_eps x[3] 3.8211499817883077 1e-5
@test_approx_eq_eps x[4] 1.3794082897556983 1e-5
@test_approx_eq_eps MathProgBase.getobjval(m) 17.014017145179164 1e-5
# Test that a second call to optimize! works
MathProgBase.setwarmstart!(m,[1,5,5,1])
MathProgBase.optimize!(m)
stat = MathProgBase.status(m)
@test stat == :Optimal
m
end
mm = nlptest()
[OMITTED...]
EXIT: Optimal Solution Found.
Ipopt.IpoptMathProgModel(Ipopt.IpoptProblem(Ptr{Void} @0x00007ff7fbf551f0,4,2,[1.0,4.742999641809297,3.8211499817883072,1.3794082897556983],[24.999999754436296,40.00000000001771],[-0.5522936588816064,0.16146856313488814],[1.0878712258659022,6.693166200640359e-10,8.887657145295419e-10,6.570872591660427e-9],[6.262653086171725e-10,9.788835007031796e-9,2.1228492520638034e-9,6.925197858854474e-10],17.014017145179164,0,eval_f_cb,eval_g_cb,eval_grad_f_cb,eval_jac_g_cb,eval_h_cb,nothing,:Min),4,0,[1.0,5.0,5.0,1.0],Any[])
u() = mm.inner.x
@code_warntype u()
Variables:
Body:
begin # none, line 1:
return (top(getfield))((top(getfield))(Main.mm,:inner)::Any,:x)::Any
end::Any