Skip to content

Commit

Permalink
Compatibility with MOI v1.23 (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
rrsadykov committed Nov 30, 2023
1 parent c7a3cd7 commit 2491880
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
14 changes: 9 additions & 5 deletions src/customdata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -150,4 +150,8 @@ MathOptInterface.Utilities.map_indices(
) = x
MathOptInterface.Utilities.map_indices(
variable_map::MathOptInterface.Utilities.IndexMap, x::Vector{AbstractCustomData}
) = x
) = 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

2 comments on commit 2491880

@rrsadykov
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/96239

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.14.1 -m "<description of version>" 24918808fca066ac7da3e4bdfbaeacbfc7e1f035
git push origin v1.14.1

Please sign in to comment.