From 0455921339b61a4e902ecaf6acfd547bdeb77093 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 19 Aug 2025 19:06:19 -0400 Subject: [PATCH 1/4] fix ConstraintName for VectorFunction --- src/MOI_wrapper.jl | 13 +++++++++++++ test/moi_tests.jl | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+) 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..c3461758 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) @@ -2053,6 +2065,13 @@ function test_issue_185() C = MOI.ConstraintIndex{F{Float64},MOI.EqualTo{Float64}} @test !MOI.supports(model, MOI.ConstraintName(), C) end + 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 From dd9cc13b3c16431ed0f52ae5d40f42e660c524e1 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 19 Aug 2025 19:06:38 -0400 Subject: [PATCH 2/4] bump --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From 4f67f797556cba6788a09be08abf23f9e0cf4124 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 19 Aug 2025 19:07:41 -0400 Subject: [PATCH 3/4] format --- test/moi_tests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/moi_tests.jl b/test/moi_tests.jl index c3461758..daa4f74c 100644 --- a/test/moi_tests.jl +++ b/test/moi_tests.jl @@ -2069,7 +2069,7 @@ function test_issue_185() 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} + C = MOI.ConstraintIndex{F{Float64},MOI.PositiveSemidefiniteConeTriangle} @test !MOI.supports(model, MOI.ConstraintName(), C) end return From e4322435b011c861d5b46e8fe8dfb94f22f2ffb3 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Wed, 20 Aug 2025 11:26:46 +1200 Subject: [PATCH 4/4] Update test/moi_tests.jl --- test/moi_tests.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/moi_tests.jl b/test/moi_tests.jl index daa4f74c..524f9914 100644 --- a/test/moi_tests.jl +++ b/test/moi_tests.jl @@ -2065,6 +2065,10 @@ function test_issue_185() C = MOI.ConstraintIndex{F{Float64},MOI.EqualTo{Float64}} @test !MOI.supports(model, MOI.ConstraintName(), C) end + 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))