File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 206
206
207
207
function MOI. dimension (sets:: OrderedProductOfSets )
208
208
@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
210
215
end
211
216
212
217
function rows (
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ MOI.Utilities.@product_of_sets(
55
55
MOI. SecondOrderCone,
56
56
)
57
57
58
- function _new_VectorSets ()
58
+ function _new_VectorSets (V = VectorSets )
59
59
return MOI. Utilities. GenericOptimizer{
60
60
Int,
61
61
MOI. Utilities. ObjectiveContainer{Int},
@@ -68,7 +68,7 @@ function _new_VectorSets()
68
68
MOI. Utilities. OneBasedIndexing,
69
69
},
70
70
Vector{Int},
71
- VectorSets {Int},
71
+ V {Int},
72
72
},
73
73
}()
74
74
end
@@ -610,6 +610,20 @@ function test_set_with_dimension()
610
610
return
611
611
end
612
612
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
+
613
627
end
614
628
615
629
TestMatrixOfConstraints. runtests ()
You can’t perform that action at this time.
0 commit comments