Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/sets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Abstract supertype for subsets of ``\\mathbb{R}``.
"""
abstract type AbstractScalarSet <: AbstractSet end

Base.broadcastable(set::AbstractScalarSet) = Ref(set)

dimension(s::AbstractScalarSet) = 1

"""
Expand Down
17 changes: 16 additions & 1 deletion test/sets.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
using Test

using MathOptInterface
const MOI = MathOptInterface

include("dummy.jl")

"""
MutLessThan{T<:Real} <: MOI.AbstractScalarSet

Expand Down Expand Up @@ -32,7 +39,15 @@ Base.copy(mlt::MutLessThan) = MutLessThan(Base.copy(mlt.upper))
@test s3.set.upper ≈ 4.0
s3_copy.set.upper = 5.0
@test s3.set.upper ≈ 4.0
@test s3_copy.set.upper ≈ 5.0
@test s3_copy.set.upper ≈ 5.0
end
end
@testset "Broadcast" begin
model = DummyModelWithAdd()
x = MOI.add_variables(model, 3)
cis = MOI.add_constraint.(model, x, MOI.EqualTo(0.0))
@test cis isa Vector{MOI.ConstraintIndex{MOI.SingleVariable,
MOI.EqualTo{Float64}}}
@test length(cis) == 3
end
end