Skip to content

Commit fcf728d

Browse files
committed
Fix removal of variables
1 parent c8618b8 commit fcf728d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

mip/lists.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ def remove(self: "VarList", vars: List["mip.Var"]):
6969
i = 0
7070
for v in self.__vars:
7171
if iv[v.idx] == 0:
72-
v.idx = -1
72+
v._idx = -1
7373
else:
74-
v.idx = i
74+
v._idx = i
7575
i += 1
7676
self.__vars = [v for v in self.__vars if v.idx != -1]
7777

test/test_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,4 +1313,4 @@ def test_remove(solver):
13131313
m.remove([None])
13141314

13151315
m.remove(constr)
1316-
# TODO: Test the removal of variables (currently failing, see https://github.com/coin-or/python-mip/pull/288#discussion_r919215654)
1316+
m.remove(x)

0 commit comments

Comments
 (0)