Does Gurobi have issue with self assignment of an expression?
AnsweredI noticed something very strange with my model. I had a line of code e.g.,
A_LinExp = A_LinExp + B_LinExp
And then I used the A_LinExp in the Objective function. However, after finding the solution, I notice that A_LinkExp.getValue() only gives the value before the self-assignment and it does not include B_LinExp. Is it a known problem with Gurobi?
-
Hi Gaurav,
I don't believe we are aware of this behavior. Are you able to provide a minimal reproducible example? I tried with the following, but it did not produce the behavior you describe:
import gurobipy as gp
m = gp.Model()
x = m.addVars(2, vtype="B")
le = x[0] + 0
le = le + x[1]
m.setObjective(le, gp.GRB.MAXIMIZE)
m.optimize()
print("value of le is:", le.getValue(), ". Expected: 2")- Riley
0 -
Dear Riley,
Thanks for your reply! It was indeed an oversight from my side.
On another note, if you allow me the liberty, I am struggling with another issue. I have a non-convex MIQP model. It is sufficiently large 3014 continuous and 1544 binary variables. But still, I find it strange that this is almost unsolvable. I set the "NoRelHeurWork" parameter to 600 and still it could not identify a feasible solution. My question is:Have I approached the limits of computational feasibility or can I make it solvable by using better modelling techniques? or a better combination of parameters.
Please find the model at the following link!https://drive.google.com/file/d/1S1YLSFECtFuxCCUPlJhJIcc4D7_PWcR8/view?usp=sharing
Thanks a lot for your answer!
0 -
There is already a post addressing the question related to Gurobi's performance on the MIQCP model (see MIQP Model taking forever to compute). Please avoid cross-posting the same question. All posts are visible to all community members and Gurobi staff.
We will address your recent comment on the other post as soon as we can.
Best regards,
Maliheh
0 -
Dear Maliheh,
Thanks for your answer!
It is, however, a different issue with a slightly different model (in this case, even a feasible solution can not be found). I am following the other post as well and look forward to your reply on that.Regards
Gaurav
0 -
Thanks for the clarification.
Since this is a different question from your original modelling question, it would have been best to create a new post in the Algorithms section and mention that this case is separate from your current post on the MIQCP issue. We would appreciate it if you could create a separate post for each different question in the future.
For now, you can leave this post as is.
Maliheh
0 -
Dear Maliheh,
I understand. I will keep it in mind for the future.
I look forward to Gurobi staff's response on the two posts. Thank you very much in advance!
Gaurav
0 -
Hi Gaurav,
I find it strange that this is almost unsolvable.
Because of this size of the model? Size and the difficulty to solve to optimality are only very loosely correlated.
I set the "NoRelHeurWork" parameter to 600 and still it could not identify a feasible solution
10 minutes is not particularly long for NoRel to run. You want to run it as long as it makes sense to, i.e. when the rate of improvement in the incumbent is worse than what it is in the tree. For some models this means not running NoRel at all, for some it means running NoRel for days.
can I make it solvable by using better modelling techniques? or a better combination of parameters.
I haven't looked at the model, and without giving specifics, I'd say the answer is almost certainly "yes". There's usually a lot of experimentation to be done with tightening, or weakening formulations, or different variable definitions, and parameter settings.
First thing I'd check is whether all the variables that participate in quadratic terms have bounds, and can you make them any tighter.
- Riley
0
Please sign in to leave a comment.
Comments
7 comments