# JuMP+MAiNGO, no method matching +()

**URL:** <https://discourse.julialang.org/t/jump-maingo-no-method-matching/114514>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, maingo\
**Created:** [May 21, 2024, 2:34pm UTC](https://discourse.julialang.org/t/jump-maingo-no-method-matching/114514 "2024-05-21T14:34:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![blob](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@blob](https://discourse.julialang.org/u/blob)\
**Post date:** [May 21, 2024, 2:34pm UTC](https://discourse.julialang.org/t/jump-maingo-no-method-matching/114514/1 "2024-05-21T14:34:24Z")

</div>

I am using JuMP to solve a nonlinear optimization problem. If I use ipopt, the solver runs. If I use MAiNGO ([GitHub - MAiNGO-github/MAiNGO.jl: A Julia Wrapper to use MAiNGO with JuMP](https://github.com/MAiNGO-github/MAiNGO.jl/tree/master)) I get an error:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/3/e36311fe7f44106bc8496c2e5d75afd3ddd26feb.png)

Minimal (not)working example (rubbish, I don’t even know if it has a solution):

```julia
using JuMP, MAiNGO
m = Model(optimizer_with_attributes(MAiNGO.Optimizer, "epsilonA"=> 1e-4))
xL = -100.0
xU = 100.0
AA = [3.0 0.0; 0.0 0.0]
@variable(m, xL.<= x[i=1:2] .<= xU)
# Define nonlinear constraints
@expression(m, e1, AA*x.*x[1])
@expression(m, e2, [x'*e1; 2*transpose(x)*e1] )
@constraint(m, c3, e2.<= 1.0)
# Define nonlinear objective
@objective(m, Min, x[1]^2+x[2]^2)
println(m)
@show c3
# Solve the optimization problem
JuMP.optimize!(m)

```

The constraint c3 with the problematic `(0)`:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/b/2bb1d0e2bb044c0918279bd96a888b42aa3018fe.png)

Debugging got me to line 190 in `MOI_wrapper.jl` and local variables:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/9/f9dedb99fafa9e9c36bd0dae80badf56b71c7dcb.png)

where we see that `x[2]*(0)` became `x[2] *+()` that, I suppose, leads to the error.

It isn’t a problem of MAiNGO installation because if I replace `@expression(m, e1, AA*x.*x[1])` with `@expression(m, e1, x.*x[1])` the solver runs. Given that ipopt runs with the problematic constraint, I suppose the error is somewhere in between JuMP and MAiNGO (MAiNGO.jl?), but I don’t have enough knowledge to figure it out, much less correct it.

---

<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:** [May 21, 2024, 8:19pm UTC](https://discourse.julialang.org/t/jump-maingo-no-method-matching/114514/2 "2024-05-21T20:19:37Z")

</div>

This is a bug in MAiNGO.

I’ve opened an issue: [Method error during `eval` · Issue #8 · MAiNGO-github/MAiNGO.jl · GitHub](https://github.com/MAiNGO-github/MAiNGO.jl/issues/8)
