What is the best way to add the following constraints in JuMP to minimize computation time? I need to solve similar models many times.
@constraint(model, [i = 1:n, j = 1:m], [t[i, j], 1, x[i, j]] in MOI.ExponentialCone())
Another way for example is to do for loops:
for j = 1:m for i = 1:n @constraint(model, [t[i, j], 1, x[i, j]] in MOI.ExponentialCone()) end end
How to do this without loops? For example, with vectors? Will vectorized codes be faster when
m is large?
As a related question, I remember I have seen cases where adding constraints with vectorized codes can be much faster than simply doing for loops, but I also heard that for loops are actually considered to be more efficient than vectorized codes. I’m a bit confused about in general which way to follow.