diff --git a/Project.toml b/Project.toml index 3ad047b6..7b91a141 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ParametricOptInterface" uuid = "0ce4ce61-57bf-432b-a095-efac525d185e" authors = ["Tomás Gutierrez "] -version = "0.12.0" +version = "0.12.1" [deps] MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" diff --git a/src/MOI_wrapper.jl b/src/MOI_wrapper.jl index 88bc3e82..6d9e520c 100644 --- a/src/MOI_wrapper.jl +++ b/src/MOI_wrapper.jl @@ -513,6 +513,19 @@ function MOI.supports( MOI.supports(model.optimizer, attr, MOI.ConstraintIndex{G,S}) end +function MOI.supports( + model::Optimizer, + attr::MOI.ConstraintName, + ::Type{MOI.ConstraintIndex{F,S}}, +) where {T,F<:MOI.VectorQuadraticFunction{T},S} + G = MOI.VectorAffineFunction{T} + # We can't tell at type-time whether the constraints will be quadratic or + # lowered to affine, so we return the conservative choice for supports of + # needing to support names for both quadratic and affine constraints. + return MOI.supports(model.optimizer, attr, MOI.ConstraintIndex{F,S}) && + MOI.supports(model.optimizer, attr, MOI.ConstraintIndex{G,S}) +end + function MOI.set( model::Optimizer, attr::MOI.ConstraintName, diff --git a/test/moi_tests.jl b/test/moi_tests.jl index ab94eb17..524f9914 100644 --- a/test/moi_tests.jl +++ b/test/moi_tests.jl @@ -2045,6 +2045,18 @@ MOI.Utilities.@model( () ); +MOI.Utilities.@model( + Model185_2, + (), + (), + (MOI.PositiveSemidefiniteConeTriangle,), + (), + (), + (), + (), + (MOI.VectorAffineFunction,) +); + function test_issue_185() inner = Model185{Float64}() mock = MOI.Utilities.MockOptimizer(inner; supports_names = false) @@ -2056,6 +2068,17 @@ function test_issue_185() return end +function test_issue_185_vector() + inner = Model185_2{Float64}() + mock = MOI.Utilities.MockOptimizer(inner; supports_names = false) + model = POI.Optimizer(MOI.Bridges.full_bridge_optimizer(mock, Float64)) + for F in (MOI.VectorAffineFunction, MOI.VectorQuadraticFunction) + C = MOI.ConstraintIndex{F{Float64},MOI.PositiveSemidefiniteConeTriangle} + @test !MOI.supports(model, MOI.ConstraintName(), C) + end + return +end + function test_psd_cone_with_parameter() #= variables: x