Skip to content

[Utilities] fix ProductOfSets to handle zero-dimensional rows#3022

Open
odow wants to merge 5 commits into
masterfrom
od/fix-product-of-sets
Open

[Utilities] fix ProductOfSets to handle zero-dimensional rows#3022
odow wants to merge 5 commits into
masterfrom
od/fix-product-of-sets

Conversation

@odow

@odow odow commented Jul 8, 2026

Copy link
Copy Markdown
Member

Closes #3019

@odow

odow commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

Okay, I'm happy with this. It's just simpler all round. It now has one UnitRange{Int} for each constraint. No more dictionary lookups, and we handle zero-dimensional rows.

VAF = MOI.VectorAffineFunction{Float64}
indices = MOI.get(sets, MOI.ListOfConstraintIndices{VAF,S}())
@test indices == MOI.ConstraintIndex{VAF,S}.([1, 3, 6, 8])
@test indices == MOI.ConstraintIndex{VAF,S}.([1, 2, 3, 4])

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The downside is that you might argue this is breaking, because we change the constraint indices. But I don't think we ever document that the index values are part of the public API. We might re-order them in any way. They just need to make sure that we iterate over them in the order that they were added (within a constraint type).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

ProductOfSets is wrong when a constraint has zero rows

1 participant