Hi @CactusHamster (I’m guessing you’re the same CactusHamster as modeling - Coding some parameters with index zero in Julia - Operations Research Stack Exchange
).
To slightly elaborate on what @Henrique_Becker said,
for i=1:10, j=1:5
@constraint(model, x[i, j] == 0)
end
will add 50 new linear constraints to your problem (rows to the constraint matrix). These should get pre-solved out by the solver, but it’s still work that needs to be done.
In contrast,
for i=1:10, j=1:5
fix(x[i, j], 0.0) # potentially with `; force = true` if there are other bounds
end
will set the lower and upper bounds of x[i, j] to 0.0. This will not add any new constraints so it might be a bit faster.