You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ProductOfSets is wrong when a constraint has zero rows #3019
changed the title [-]MatrixOfConstraints is wrong when a constraint has zero rows[/-][+]ProductOfSets is wrong when a constraint has zero rows[/+]on Jul 8, 2026
julia>import MathOptInterface as MOI
julia>using Test
julia> MOI.Utilities.@product_of_sets(VectorSets, MOI.Nonnegatives)
julia> F, S = MOI.VectorAffineFunction{Int}, MOI.Nonnegatives
(MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives)
julia>@testset"A"begin
sets =VectorSets{Int}()
i = MOI.Utilities.set_index(sets, S)
MOI.Utilities.add_set(sets, i, 0)
MOI.Utilities.final_touch(sets)
@test (F, S) in MOI.get(sets, MOI.ListOfConstraintTypesPresent())
@test MOI.get(sets, MOI.NumberOfConstraints{F,S}()) ==1
c = MOI.ConstraintIndex{F,S}.(1:1)
@test MOI.get(sets, MOI.ListOfConstraintIndices{F,S}()) == c
@testall(MOI.is_valid(sets, ci) for ci in c)
end
A: Test Failed at REPL[76]:6
Expression: (F, S) in MOI.get(sets, MOI.ListOfConstraintTypesPresent())
Evaluated: (MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives) in Tuple{Type, Type}[]
Stacktrace:
A: Test Failed at REPL[76]:7
Expression: MOI.get(sets, MOI.NumberOfConstraints{F, S}()) ==1
Evaluated:0==1
Stacktrace:
A: Test Failed at REPL[76]:9
Expression: MOI.get(sets, MOI.ListOfConstraintIndices{F, S}()) == c
Evaluated: MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives}[] == MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives}[MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives}(1)]
Stacktrace:
A: Test Failed at REPL[76]:10
Expression:all((MOI.is_valid(sets, ci) for ci = c))
Stacktrace:
Test Summary:| Fail Total Time
A |440.0s
RNG of the outermost testset: Random.Xoshiro(0x9fa7d8cebe81f901, 0xc2272e9fdfe46f03, 0xe8bffbd11d93aff9, 0x498d4a92bd73bbf7, 0x74ba59c7203bd9a8)
ERROR: Some tests did not pass:0 passed, 4 failed, 0 errored, 0 broken.
julia>@testset"B"begin
sets =VectorSets{Int}()
i = MOI.Utilities.set_index(sets, S)
MOI.Utilities.add_set(sets, i, 0)
MOI.Utilities.add_set(sets, i, 2)
MOI.Utilities.add_set(sets, i, 0)
MOI.Utilities.add_set(sets, i, 1)
MOI.Utilities.add_set(sets, i, 0)
MOI.Utilities.final_touch(sets)
@test (F, S) in MOI.get(sets, MOI.ListOfConstraintTypesPresent())
@test MOI.get(sets, MOI.NumberOfConstraints{F,S}()) ==5
c = MOI.ConstraintIndex{F,S}.(1:5)
@test MOI.get(sets, MOI.ListOfConstraintIndices{F,S}()) == c
@testall(MOI.is_valid(sets, ci) for ci in c)
end
B: Test Failed at REPL[77]:11
Expression: MOI.get(sets, MOI.NumberOfConstraints{F, S}()) ==5
Evaluated:2==5
Stacktrace:
B: Test Failed at REPL[77]:13
Expression: MOI.get(sets, MOI.ListOfConstraintIndices{F, S}()) == c
Evaluated: MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives}[MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives}(1), MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives}(3)] == MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives}[MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives}(1), MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives}(2), MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives}(3), MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives}(4), MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Int64}, MathOptInterface.Nonnegatives}(5)]
Stacktrace:
B: Test Failed at REPL[77]:14
Expression:all((MOI.is_valid(sets, ci) for ci = c))
Stacktrace:
Test Summary:| Pass Fail Total Time
B |1340.0s
RNG of the outermost testset: Random.Xoshiro(0x9fa7d8cebe81f901, 0xc2272e9fdfe46f03, 0xe8bffbd11d93aff9, 0x498d4a92bd73bbf7, 0x74ba59c7203bd9a8)
ERROR: Some tests did not pass:1 passed, 3 failed, 0 errored, 0 broken.
Activity
[-]MatrixOfConstraints is wrong when a constraint has zero rows[/-][+]ProductOfSets is wrong when a constraint has zero rows[/+]odow commentedon Jul 8, 2026
So this is actually a problem with
ProductOfSets:odow commentedon Jul 8, 2026
So fixing this requires quite a large change to ProductOfSets. I need to think about the best approach.
In the near-term, I'm fixing Pajarito to stop it modifying zero-dimensional constraints: jump-dev/Pajarito.jl#460