Adding a few variables and constraints makes the model nearly unsolvable

Hi all,

I know that this has nothing to do with Julia, but although I asked the following question in Gurobi community, I have not received a response yet. Could you please help me with the following issue?

I have a power systems optimization model. It is pretty large model, but Gurobi did not have any problem to solve it in 4 hours. This was the situation a few weeks ago. Below, you can see the number of variables and constraints before and after pre-solve procedure.

I recently added a few decision variables (126 continuous and 42 binary) and constraints. Gurobi can not solve this new model in 22 hours. Below, you can see the number of variables and constraints before and after pre-solve.

So, previously, there were 1,541,716 continuous decision variables before pre-solve. I added 126 continuous variables and total number of continuous decision variables turned out to be 1,541,842 in new model. This is correct. Similarly, there were 369,640 integer variables. I added 42 binary variables to the model and total number of integer variables turned out to be 369,682. This is correct too.

What I do not understand is the big difference in number of integer variables after pre-solve in two models. Previously, there were 251,215 integer variables after pre-solve. In the new model, this number is 369,115. Why is this happening? I assume that this is the reason why Gurobi can not solve the recent model in a reasonable amount of time. Again, previous model was solved by Gurobi in 4 hours. However, the recent model can not be solved in 22 hours. 22 hours is the time limit I put for Gurobi. All 22 hours were spent for root relaxation. I do not event see the log for branch and bound tree.

Can you please help me with this?

Kind regards

MIPs are really hard to solve. Small changes can have a big impact. So I’d say this is expected behavior.

Gurobi support may have suggestions for settings that could help.

1 Like

Notice that you have also made the problem more difficult numerically; you can see the warning in the second log, and the span of the order of magnitudes has increased by 1000 in the matrix range and RHS range (Are you maybe adding big-M constraints? These can sometimes be specially reformulated using SOS type constraints.)

1 Like

Thank you. I am waiting for their response. I was not expecting that these new constraints would make such a big impact.

Yes, I am adding bigM constraints. So, you suggest me to look at SOS type constraints. I What else do you suggest? I feel that I have to solve this issue before I solve it again.

Providing advice on a particular model is very hard without knowing the specifics. MIPs are hard to solve, and seemingly trivial changes (like re-arranging the order of the variables or constraints, or adding new variables and constraints) can have a big impact.

Read the Gurobi guidelines. You have both big-M and large coefficients. The “Warning: Model contains” is a hint that you should reformulate your model.

Read the JuMP documentation around indicator and SOS constraints:

You should also provide a feasible starting solution to your new formulation:

1 Like

Hi,

Thank you for your reply, and sorry for the long-delayed response from me. I have been traveling and have not had a chance to reply. However, I was working on this issue. I have played with some Gurobi parameters (MIPFocus, Method, ImproveStateTime, etc.), but it did not help much. As the warnings indicate, my model has numerical issues stemming from large matrix coefficient range and objective range. Hence, I will try to do scaling to shrink these ranges.

I have a question. Is there a quick way to see summary of the model (by summary, I mean matrix coefficient range, objective range, RHS range, etc.) without solving it? I will do several scaling attempts. I do not want to wait to see their effects until the model is solved.

According to this link Feature Request: printStats(model) · Issue #152 · jump-dev/JuMP.jl · GitHub, there is no such thing, but I wanted to make sure.

Thank you

No, there is no tool for that. The warnings come from Gurobi, not JuMP.