-
Notifications
You must be signed in to change notification settings - Fork 100
Closed
Labels
bugSomething isn't workingSomething isn't workinggurobiAll items related to gurobiAll items related to gurobi
Description
In get_objective in gurobi.py you are trying to set the const property of LinExpr, which doesn't have a setter.
To reproduce:
>>> import mip
>>> model = mip.Model(solver_name="gurobi")
Set parameter Username
Academic license - for non-commercial use only - expires 2023-07-07
>>> x = model.add_var("x"I)
>>> model.objective = x
>>> model.objective
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mkrimmel/.local/lib/python3.8/site-packages/mip/model.py", line 821, in objective
return self.solver.get_objective()
File "/home/mkrimmel/.local/lib/python3.8/site-packages/mip/gurobi.py", line 543, in get_objective
obj_expr.const = self.get_objective_const()
AttributeError: can't set attributeNot sure why const cannot have a setter. Either way, you could just use the constructor of LinExpr directly. I may prepare a PR for this because I probably need to have this fixed.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggurobiAll items related to gurobiAll items related to gurobi