# MethodError: no method matching \_parse\_NL\_expr\_runtime (Bilevel problem)

**URL:** <https://discourse.julialang.org/t/methoderror-no-method-matching-parse-nl-expr-runtime-bilevel-problem/51681>\
**Category:** Optimization (Mathematical)\
**Tags:** question, package, jump, nonlinear\
**Created:** [December 11, 2020, 7:26pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-parse-nl-expr-runtime-bilevel-problem/51681 "2020-12-11T19:26:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![trathi](https://avatars.discourse-cdn.com/v4/letter/t/7c8e57/32.png) [@trathi](https://discourse.julialang.org/u/trathi)\
**Post date:** [December 11, 2020, 7:26pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-parse-nl-expr-runtime-bilevel-problem/51681/1 "2020-12-11T19:26:59Z")

</div>

I am trying to solve a bilevel problem using the [BilevelJuMP](https://github.com/joaquimg/BilevelJuMP.jl) 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:

```julia
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.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [December 12, 2020, 3:25am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-parse-nl-expr-runtime-bilevel-problem/51681/2 "2020-12-12T03:25:21Z")

</div>

It looks like BilevelJuMP doesn’t support nonlinear programs: [https://github.com/joaquimg/BilevelJuMP.jl/issues/57](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](https://github.com/jump-dev/JuMP.jl/issues/2402)

---

<div class="post-metadata">

**Author:** ![trathi](https://avatars.discourse-cdn.com/v4/letter/t/7c8e57/32.png) [@trathi](https://discourse.julialang.org/u/trathi)\
**Post date:** [December 12, 2020, 3:44am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-parse-nl-expr-runtime-bilevel-problem/51681/3 "2020-12-12T03:44:50Z")

</div>

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.
