File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -195,11 +195,20 @@ def test_cons_indicator_with_matrix_binvar():
195
195
m .addConsIndicator (y >= 1 , binvar2 , activeone = True )
196
196
m .addConsIndicator (y <= 0 , binvar2 , activeone = False )
197
197
198
- m .setObjective (binvar1 .sum () + binvar2 .sum (), "maximize" )
198
+ # test binvar with (2, 1) shape of list of lists
199
+ z = m .addVar (vtype = "B" )
200
+ binvar3 = [[m .addVar (vtype = "B" )], [m .addVar (vtype = "B" )]]
201
+ m .addConsIndicator (z >= 1 , binvar3 , activeone = True )
202
+ m .addConsIndicator (z <= 0 , binvar3 , activeone = False )
203
+
204
+ m .setObjective (
205
+ binvar1 .sum () + binvar2 .sum () + binvar3 [0 ][0 ] + binvar3 [0 ][1 ], "maximize"
206
+ )
199
207
m .optimize ()
200
208
201
209
assert m .getVal (x ) == 1
202
210
assert m .getVal (y ) == 1
211
+ assert m .getVal (z ) == 1
203
212
204
213
@pytest .mark .xfail (
205
214
reason = "addConsIndicator doesn't behave as expected when binary variable is False. See Issue #717."
You can’t perform that action at this time.
0 commit comments