From 24918808fca066ac7da3e4bdfbaeacbfc7e1f035 Mon Sep 17 00:00:00 2001 From: Ruslan Sadykov <41117501+rrsadykov@users.noreply.github.com> Date: Thu, 30 Nov 2023 17:13:24 +0100 Subject: [PATCH] Compatibility with MOI v1.23 (#102) --- Project.toml | 2 +- src/customdata.jl | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Project.toml b/Project.toml index 132cd12..b08760e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "BlockDecomposition" uuid = "6cde8614-403a-11e9-12f1-c10d0f0caca0" authors = ["Guillaume Marques", "Vitor Nesello", "François Vanderbeck"] -version = "1.14.0" +version = "1.14.1" [deps] Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" diff --git a/src/customdata.jl b/src/customdata.jl index e4515bc..7642e2c 100644 --- a/src/customdata.jl +++ b/src/customdata.jl @@ -109,12 +109,12 @@ end function MOI.set( dest::MOIU.UniversalFallback, attribute::CustomVarValue, vi::MOI.VariableIndex, value::CD -) where CD <: AbstractCustomData +) where {CD<:AbstractCustomData} if CD ∉ MOI.get(dest, CustomVars()) throw(UnregisteredCustomDataFamily(string(CD))) end if !haskey(dest.varattr, attribute) - dest.varattr[attribute] = Dict{MOI.VariableIndex, Any}() + dest.varattr[attribute] = Dict{MOI.VariableIndex,Any}() end dest.varattr[attribute][vi] = value return @@ -128,12 +128,12 @@ end function MOI.set( dest::MOIU.UniversalFallback, attribute::CustomConstrValue, ci::MOI.ConstraintIndex, value::CD -) where CD <: AbstractCustomData +) where {CD<:AbstractCustomData} if CD ∉ MOI.get(dest, CustomConstrs()) throw(UnregisteredCustomDataFamily(string(CD))) end if !haskey(dest.conattr, attribute) - dest.conattr[attribute] = Dict{MOI.ConstraintIndex, Any}() + dest.conattr[attribute] = Dict{MOI.ConstraintIndex,Any}() end dest.conattr[attribute][ci] = value return @@ -150,4 +150,8 @@ MathOptInterface.Utilities.map_indices( ) = x MathOptInterface.Utilities.map_indices( variable_map::MathOptInterface.Utilities.IndexMap, x::Vector{AbstractCustomData} -) = x \ No newline at end of file +) = x + +# added for compatibility with MathOptInterface v1.23 +MathOptInterface.Utilities.map_indices(f::Function, x::AbstractCustomData) = x +MathOptInterface.Utilities.map_indices(f::Function, x::Vector{AbstractCustomData}) = x \ No newline at end of file