MethodError: no method matching _parse_NL_expr_runtime (Bilevel problem)

I am trying to solve a bilevel problem using the BilevelJuMP package. However, I get the following error on execution: MethodError: no method matching _parse_NL_expr_runtime(::BilevelJuMP.UpperModel, ::Int64, ::Array{JuMP._Derivatives.NodeData,1}, ::Int64, ::Array{Float64,1}).

MWE:

using JuMP, Ipopt, BilevelJuMP

#data
demand = 100
A = [4, 6, 2, 5, 3]
B = [0.6, 0.9, 0.3, 0.75, 0.45]
c = [40, 40, 60, 40, 40]
r = [2, 2, 1, 2, 2]

model = BilevelModel(Ipopt.Optimizer, mode = BilevelJuMP.SOS1Mode())

@variable(Lower(model), x[1:5]>=0)
@variable(Upper(model), y[1:5]>=0)

@NLobjective(Upper(model), Min, sum( ( (A[i] + B[i]*(x[i]/(c[i]+y[i]))^4)*x[i] + 1.5*r[i]*y[i]^2 ) for i=1:5) )

@NLobjective(Lower(model), Min, sum( ( (A[i] + B[i]*(x[i]/(c[i]+y[i]))^4)*x[i]/5 ) for i=1:5) )
@constraints(Lower(model), begin
    x[1] + x[2] == demand
    x[1] == x[3] + x[4]
    x[2] + x[3] == x[5]
    x[4] + x[5] == demand
end)

optimize!(model)

Can someone point out the mistake? Thank you.

It looks like BilevelJuMP doesn’t support nonlinear programs: https://github.com/joaquimg/BilevelJuMP.jl/issues/57

However, it should throw a more-helpful error message. Edit: https://github.com/jump-dev/JuMP.jl/issues/2402

1 Like

Yes, this does make sense. Thanks for raising the issue.
In the meantime, do you have any recommendations on any package that could deal with non-linearity in bilevel problems for now? Even good feasible solutions would suffice considering bilevel problems are not easy to solve.