I am constructing large LP model with JuMP, that I want to solve using Gurobi. I get the following warning:
WARNING: The addition operator has been used on JuMP expressions a large number of times. This warning is safe to ignore but may indicate that model generation is slower than necessary. For performance reasons, you should not add expressions in a loop. Instead of x += y, use append!(x,y) to modify x in place. If y is a single variable, you may also use push!(x, coef, y) in place of x += coef*y.
I’m not sure what this means and how I can fix it. Looking at the output, I find that the model generation phase is very slow. After the model is generated, Gurobi solves it fast, in a few iterations with O(1) seconds each.
I don’t want to post my full code here because it is problem specific and complex. I would really appreciate some pointers on the meaning of the Warning above and how I can start looking to find the issue.