File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 206206
207207function MOI. dimension (sets:: OrderedProductOfSets )
208208 @assert sets. final_touch
209- return sets. num_rows[end ]
209+ if isempty (sets. num_rows)
210+ # There is no set type
211+ return 0
212+ else
213+ return sets. num_rows[end ]
214+ end
210215end
211216
212217function rows (
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ MOI.Utilities.@product_of_sets(
5555 MOI. SecondOrderCone,
5656)
5757
58- function _new_VectorSets ()
58+ function _new_VectorSets (V = VectorSets )
5959 return MOI. Utilities. GenericOptimizer{
6060 Int,
6161 MOI. Utilities. ObjectiveContainer{Int},
@@ -68,7 +68,7 @@ function _new_VectorSets()
6868 MOI. Utilities. OneBasedIndexing,
6969 },
7070 Vector{Int},
71- VectorSets {Int},
71+ V {Int},
7272 },
7373 }()
7474end
@@ -610,6 +610,20 @@ function test_set_with_dimension()
610610 return
611611end
612612
613+ MOI. Utilities. @product_of_sets (EmptyProductOfSets)
614+
615+ function test_empty_product_of_sets (T = Int)
616+ model = _new_VectorSets (EmptyProductOfSets)
617+ x = MOI. add_variable (model)
618+ MOI. Utilities. final_touch (model, nothing )
619+ A = convert (
620+ SparseArrays. SparseMatrixCSC{T,Int},
621+ model. constraints. coefficients,
622+ )
623+ @test size (A) == (0 , 1 )
624+ return
625+ end
626+
613627end
614628
615629TestMatrixOfConstraints. runtests ()
You can’t perform that action at this time.
0 commit comments