# Constraints of type MathOptInterface.ScalarNonlinearFunction-in-MathOptInterface.LessThan{Float64} are not supported by the solver

**URL:** https://discourse.julialang.org/t/constraints-of-type-mathoptinterface-scalarnonlinearfunction-in-mathoptinterface-lessthan-float64-are-not-supported-by-the-solver/126178
**Category:** Optimization (Mathematical)
**Tags:** nonlinear, gurobi, nonlinear-optimizati, nonlinear-programmin
**Created:** [February 22, 2025, 10:03am UTC](https://discourse.julialang.org/t/constraints-of-type-mathoptinterface-scalarnonlinearfunction-in-mathoptinterface-lessthan-float64-are-not-supported-by-the-solver/126178 "2025-02-22T10:03:07Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![leonie25](https://avatars.discourse-cdn.com/v4/letter/l/ecb155/32.png) [@leonie25](https://discourse.julialang.org/u/leonie25)
#### Post date: [February 22, 2025, 10:03am UTC](https://discourse.julialang.org/t/constraints-of-type-mathoptinterface-scalarnonlinearfunction-in-mathoptinterface-lessthan-float64-are-not-supported-by-the-solver/126178/1 "2025-02-22T10:03:07Z")

</div>

I am working on an optimization problem and build a model using Gurobi Optimizer with JuMP. It has some nonlinear constraints:  
@constraint(model, f[i] + func(qe[i])\<= M1 \* (1 - x[(i, j)]) + f[j])  
where f, qe, x are nonnegative variables, and func is a function:  
function func(q)  
return (10 + q)^(3 / 2)  
end

The weird thing is that it worked before today. I reinstalled julia, ran it and got an error:  
Constraints of type MathOptInterface.ScalarNonlinearFunction-in-MathOptInterface.LessThan{Float64} are not supported by the solver.  
😭

---

<div class="post-metadata">

### Author: ![ashefa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashefa/32/2525_2.png) [@ashefa](https://discourse.julialang.org/u/ashefa)
#### Post date: [February 22, 2025, 10:29am UTC](https://discourse.julialang.org/t/constraints-of-type-mathoptinterface-scalarnonlinearfunction-in-mathoptinterface-lessthan-float64-are-not-supported-by-the-solver/126178/2 "2025-02-22T10:29:32Z")

</div>

Did you test with a nonlinear solver, like `Ipopot`?

---

<div class="post-metadata">

### Author: ![leonie25](https://avatars.discourse-cdn.com/v4/letter/l/ecb155/32.png) [@leonie25](https://discourse.julialang.org/u/leonie25)
#### Post date: [February 22, 2025, 12:11pm UTC](https://discourse.julialang.org/t/constraints-of-type-mathoptinterface-scalarnonlinearfunction-in-mathoptinterface-lessthan-float64-are-not-supported-by-the-solver/126178/4 "2025-02-22T12:11:19Z")

</div>

Test with the solver to Ipopt.Optimizer, got this:  
ERROR: MathOptInterface.UnsupportedConstraint{MathOptInterface.VariableIndex, MathOptInterface.ZeroOne}(“”)

---

<div class="post-metadata">

### Author: ![leonie25](https://avatars.discourse-cdn.com/v4/letter/l/ecb155/32.png) [@leonie25](https://discourse.julialang.org/u/leonie25)
#### Post date: [February 22, 2025, 12:50pm UTC](https://discourse.julialang.org/t/constraints-of-type-mathoptinterface-scalarnonlinearfunction-in-mathoptinterface-lessthan-float64-are-not-supported-by-the-solver/126178/5 "2025-02-22T12:50:47Z")

</div>

The versions I use:  
julia 1.11.2  
gurobi 9.5.2  
Is it because of version incompatibility?

---

<div class="post-metadata">

### Author: ![ashefa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashefa/32/2525_2.png) [@ashefa](https://discourse.julialang.org/u/ashefa)
#### Post date: [February 22, 2025, 2:04pm UTC](https://discourse.julialang.org/t/constraints-of-type-mathoptinterface-scalarnonlinearfunction-in-mathoptinterface-lessthan-float64-are-not-supported-by-the-solver/126178/6 "2025-02-22T14:04:29Z")

</div>

Ipopt does not support binary variables (`x[(i, j)]`). Why do you not write the polynomial function `func` within the constraint instead of defining a function?

---

<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: [February 22, 2025, 6:51pm UTC](https://discourse.julialang.org/t/constraints-of-type-mathoptinterface-scalarnonlinearfunction-in-mathoptinterface-lessthan-float64-are-not-supported-by-the-solver/126178/7 "2025-02-22T18:51:32Z")

</div>

Hi @leonie25, welcome to the forum 😄

Gurobi’s support for nonlinear constraints is a very recent feature. You need to install Gurobi v12.

You can check which version of Gurobi you are running with

```julia
import Gurobi
Gurobi._GUROBI_VERSION

```

We should be able to automatically install Gurobi v12, so do:

```Julia
import Pkg
Pkg.update()

```

then restart Julia.

If that doesn’t work, please run

```julia
import Pkg
Pkg.status()

```

and let me know what the output is.

---

<div class="post-metadata">

### Author: ![leonie25](https://avatars.discourse-cdn.com/v4/letter/l/ecb155/32.png) [@leonie25](https://discourse.julialang.org/u/leonie25)
#### Post date: [February 23, 2025, 4:11am UTC](https://discourse.julialang.org/t/constraints-of-type-mathoptinterface-scalarnonlinearfunction-in-mathoptinterface-lessthan-float64-are-not-supported-by-the-solver/126178/8 "2025-02-23T04:11:38Z")

</div>

It works! Thank you! 😃 😆  
(However, it did work several days ago with Gurobi 9.5.2, after I reinstalled julia and JuMP, it failed. Maybe because of version incompatibility, but I forgot the old version.)

---

<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: [February 23, 2025, 4:20am UTC](https://discourse.julialang.org/t/constraints-of-type-mathoptinterface-scalarnonlinearfunction-in-mathoptinterface-lessthan-float64-are-not-supported-by-the-solver/126178/9 "2025-02-23T04:20:46Z")

</div>

This cannot have worked with Gurobi 9 because that version of Gurobi did not support nonlinear.

We will have automatically installed Gurobi 12 for you 😄
