JuliaMath / IntervalSets.jl

Interval Sets for Julia
https://juliamath.github.io/IntervalSets.jl/
Other
99 stars 27 forks source link

Multidimensional interval sets #66

Open zsunberg opened 4 years ago

zsunberg commented 4 years ago

It would be nice to have some multidimensional interval sets, i.e. Interval([1,1], [2,3]) would be the "box" between 1 and 2 on the x axis and between 1 and 3 on the y axis.

Currently, it doesn't work as we would want it to:

julia> [1.5,2.5] in Interval([1,1], [2,2])
true

see e.g. JuliaPOMDP/POMDPs.jl#301, JuliaReinforcementLearning/CommonRLInterface.jl#15 for description of needs.

Is that beyond the scope of this package?

dlfivefifty commented 4 years ago

You could use ProductDomain from DomainSets.jl to represent this as a product of two intervals

timholy commented 4 years ago
julia> all((1.5, 1.7) .∈ (1..2, 1..2))
true

julia> all((1.5, 2.7) .∈ (1..2, 1..2))
false

When it's just broadcasting, I'd be reluctant to add something to this package.

timholy commented 4 years ago

Interval([1,1], [2,2]) seems busted.