From 31d512a8a170bed4280c436bb9f3c05016601267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Besan=C3=A7on?= Date: Thu, 18 Apr 2019 10:03:01 +0200 Subject: [PATCH 1/2] remove doubled method --- src/Test/intlinear.jl | 2 -- src/sets.jl | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Test/intlinear.jl b/src/Test/intlinear.jl index 0663fc8298..89368d217b 100644 --- a/src/Test/intlinear.jl +++ b/src/Test/intlinear.jl @@ -82,8 +82,6 @@ function int1test(model::MOI.ModelLike, config::TestConfig) end end -Base.isapprox(a::T, b::T; kwargs...) where T <: Union{MOI.SOS1, MOI.SOS2} = isapprox(a.weights, b.weights; kwargs...) - # sos from CPLEX.jl" begin function int2test(model::MOI.ModelLike, config::TestConfig) atol = config.atol diff --git a/src/sets.jl b/src/sets.jl index f9195c1b61..de706488ea 100644 --- a/src/sets.jl +++ b/src/sets.jl @@ -418,7 +418,6 @@ struct SOS1{T <: Real} <: AbstractVectorSet end Base.:(==)(a::SOS1{T}, b::SOS1{T}) where T = a.weights == b.weights -Base.isapprox(a::SOS1{T}, b::SOS1{T}; kwargs...) where T = isapprox(a.weights, b.weights; kwargs...) """ SOS2{T <: Real}(weights::Vector{T}) @@ -434,10 +433,9 @@ struct SOS2{T <: Real} <: AbstractVectorSet end Base.:(==)(a::SOS2{T}, b::SOS2{T}) where T = a.weights == b.weights -Base.isapprox(a::SOS2{T}, b::SOS2{T}; kwargs...) where T = isapprox(a.weights, b.weights; kwargs...) dimension(s::Union{SOS1, SOS2}) = length(s.weights) - +Base.isapprox(a::T, b::T; kwargs...) where T <: Union{MOI.SOS1, MOI.SOS2} = isapprox(a.weights, b.weights; kwargs...) # isbits types, nothing to copy function Base.copy(set::Union{Reals, Zeros, Nonnegatives, Nonpositives, From 48af5f2783e8c6105af4b48b9e1d8c484e4c60c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Besan=C3=A7on?= Date: Thu, 18 Apr 2019 10:09:36 +0200 Subject: [PATCH 2/2] join == function --- src/sets.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sets.jl b/src/sets.jl index de706488ea..9e12d83b97 100644 --- a/src/sets.jl +++ b/src/sets.jl @@ -417,8 +417,6 @@ struct SOS1{T <: Real} <: AbstractVectorSet weights::Vector{T} end -Base.:(==)(a::SOS1{T}, b::SOS1{T}) where T = a.weights == b.weights - """ SOS2{T <: Real}(weights::Vector{T}) @@ -432,10 +430,10 @@ struct SOS2{T <: Real} <: AbstractVectorSet weights::Vector{T} end -Base.:(==)(a::SOS2{T}, b::SOS2{T}) where T = a.weights == b.weights +Base.:(==)(a::T, b::T) where {T <: Union{SOS1, SOS2}} = a.weights == b.weights +Base.isapprox(a::T, b::T; kwargs...) where {T <: Union{SOS1, SOS2}} = isapprox(a.weights, b.weights; kwargs...) dimension(s::Union{SOS1, SOS2}) = length(s.weights) -Base.isapprox(a::T, b::T; kwargs...) where T <: Union{MOI.SOS1, MOI.SOS2} = isapprox(a.weights, b.weights; kwargs...) # isbits types, nothing to copy function Base.copy(set::Union{Reals, Zeros, Nonnegatives, Nonpositives,