Closed gdragotto closed 2 years ago
Hi @gdragotto,
thanks for reporting your issue.
On the one hand, from a quick look, it might be associated with #214. Is your problem only related to gurobi - so CBC works fine?
On the other hand, could you please provide a complete minimalistic python code example that could be run to see/debug your results? Thanks!
Hello,
just a follow up: fixed in #214
Hello,
I started to believe that I get the wrong objective function with Gurobi, although the optimal solution itself is correct.
I build an objective function inside a LinExpr that looks like
+ 2.8yBR_0-1 + 4.199999999999999yBR_0-2 + 4.199999999999999yBR_0-3 + 2.8yBR_1-0 + 2.8yBR_1-2 + 4.199999999999999yBR_1-3 + 7.0yBR_2-1 + 4.199999999999999yBR_2-3 + 7.0yBR_3-0 - 28.0
whereyBR
are my decision variables.However, when I set the objective through
model.objective = maximize(objective)
with objective containing the above expression, the constant -28.0 gets translated in 28. Specifically, if I open the MIP file I see something likeMaximize [...] + 28Constant
and in the variablesConstant = 1
Further, if I query
print(model.objective.const)
I get the correct -28.0.Expected behavior The package should optimize with the correct constant shift of -28
Desktop (please complete the following information):
EDIT Here's how I make it work: