# Constraints of function in the Set MathOptInterface.Interval{Float64} are not implemented

**URL:** <https://discourse.julialang.org/t/constraints-of-function-in-the-set-mathoptinterface-interval-float64-are-not-implemented/62441>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [June 5, 2021, 3:17pm UTC](https://discourse.julialang.org/t/constraints-of-function-in-the-set-mathoptinterface-interval-float64-are-not-implemented/62441 "2021-06-05T15:17:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zlq178](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zlq178/32/17952_2.png) [@zlq178](https://discourse.julialang.org/u/zlq178)\
**Post date:** [June 5, 2021, 3:17pm UTC](https://discourse.julialang.org/t/constraints-of-function-in-the-set-mathoptinterface-interval-float64-are-not-implemented/62441/1 "2021-06-05T15:17:45Z")

</div>

The model is a bi\_level model with Gurobi solver.  
There are a number of continuous variables and one binary variable.  
When solving this model, it shows such wrong. What does it mean? How can I find the wrong constraint?

```julia
LoadError: Constraints of function MathOptInterface.ScalarAffineFunction{Float64} in the Set MathOptInterface.Interval{Float64} are not implemented
Stacktrace:
 [1] error(::String, ::Type{T} where T, ::String, ::Type{T} where T, ::String) at .\error.jl:42
 [2] supported_constraints(::Array{Tuple{DataType,DataType},1}) at C:\Users\ipso17.GXU\.julia\packages\Dualization\fSW2B\src\supported.jl:9
 [3] dualize(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64,MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}}, ::Dualization.DualProblem{Float64,MathOptInterface.Utilities.GenericModel{Float64,Dualization.DualizableModelFunctionConstraints{Float64}}}, ::Dualization.DualNames, ::Array{MathOptInterface.VariableIndex,1}, ::Bool) at C:\Users\ipso17.GXU\.julia\packages\Dualization\fSW2B\src\dualize.jl:27
 [4] #dualize#1 at C:\Users\ipso17.GXU\.julia\packages\Dualization\fSW2B\src\dualize.jl:8 [inlined]
 [5] build_bilevel(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64,MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}}, 
::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64,MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}}, ::Dict{MathOptInterface.VariableIndex,MathOptInterface.VariableIndex}, ::Array{MathOptInterface.VariableIndex,1}, ::BilevelJuMP.SOS1Mode{Float64}, ::Dict{MathOptInterface.VariableIndex,MathOptInterface.ConstraintIndex}; copy_names::Bool, pass_start::Bool) at C:\Users\ipso17.GXU\.julia\packages\BilevelJuMP\wSyR2\src\moi.jl:286
 [6] optimize!(::BilevelModel; lower_prob::String, upper_prob::String, bilevel_prob::String, solver_prob::String, file_format::MathOptInterface.FileFormats.FileFormat) at C:\Users\ipso17.GXU\.julia\packages\BilevelJuMP\wSyR2\src\jump.jl:394
 [7] optimize!(::BilevelModel) at C:\Users\ipso17.GXU\.julia\packages\BilevelJuMP\wSyR2\src\jump.jl:354

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/0/109ba39dadd7f2dbaf9985b07e30902d7bfa5908.png)

Thank you for your help!

---

<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:** [June 6, 2021, 9:43pm UTC](https://discourse.julialang.org/t/constraints-of-function-in-the-set-mathoptinterface-interval-float64-are-not-implemented/62441/2 "2021-06-06T21:43:06Z")

</div>

The error is saying that you can’t dualize a `Interval` constraint.

Look for a constraint like `@constraint(model, 1 <= a' x <= 2)` in your model and rewrite it as two inequalities:

```nohighlight
@constraint(model, 1 <= a' x)
@constraint(model, a' x <= 2)

```

---

<div class="post-metadata">

**Author:** ![zlq178](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zlq178/32/17952_2.png) [@zlq178](https://discourse.julialang.org/u/zlq178)\
**Post date:** [June 7, 2021, 8:19am UTC](https://discourse.julialang.org/t/constraints-of-function-in-the-set-mathoptinterface-interval-float64-are-not-implemented/62441/3 "2021-06-07T08:19:29Z")

</div>

Nice!
