Skip to content

Commit

Permalink
Fixed remove for gurobi
Browse files Browse the repository at this point in the history
  • Loading branch information
ElFosco committed Sep 8, 2023
1 parent a024791 commit 6396bba
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cpmpy/solvers/gurobi.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,17 +395,15 @@ def __add__(self, cpm_expr_orig):

else:
raise NotImplementedError(cpm_expr) # if you reach this... please report on github

#self.grb_model.update()
return self


def __sub__(self, cpm_expr_orig):

for c in self.cons:
if c[1] == cpm_expr_orig:
print(c[0])
self.grb_model.remove(c[0])
self.cons.remove(c)
[self.grb_model.remove(c[0]) for c in self.cons if str(c[1]) == str(cpm_expr_orig)]
self.cons = [c for c in self.cons if str(c[1]) != str(cpm_expr_orig)]
#self.grb_model.update()

return self

Expand Down

0 comments on commit 6396bba

Please sign in to comment.