Skip to content

MOI.Interval with pi error #2576

@johnaoga

Description

@johnaoga

Hello,

I'm working with MOI.Interval and pi and got into the following error that is of course easy to solve on my side using 0+pi or 1*pi or any other operation. But I'm reporting it here anyway.

The error

ERROR: MethodError: no method matching MathOptInterface.Interval(::Float64, ::Irrational{:π})
The type `MathOptInterface.Interval` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  MathOptInterface.Interval(::T, ::T) where T<:Real
   @ MathOptInterface ~/.julia/packages/MathOptInterface/1fRdT/src/sets.jl:285
  MathOptInterface.Interval(::MathOptInterface.GreaterThan{<:AbstractFloat})
   @ MathOptInterface ~/.julia/packages/MathOptInterface/1fRdT/src/sets.jl:320
  MathOptInterface.Interval(::MathOptInterface.LessThan{<:AbstractFloat})
   @ MathOptInterface ~/.julia/packages/MathOptInterface/1fRdT/src/sets.jl:321
  ...

Way to reproduce it

using JuMP
using HiGHS

model = Model(HiGHS.Optimizer)

@variable(model, x >= 0)
@variable(model, y >= 0)

@constraint(model, x + y in MOI.Interval(-pi, pi))

optimize!(model)
println(value(x))

The error is on the @constraint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions