Wait, you already created a model for this problem and solve it???
not a JuMP model, you can’t express this as a linear problem, and I don’t think it’s even a convex problem
just a few loops over the 1,000,000 possibilities and keeping the best arrangement
1 Like
I was thinking is it possible to put a @variable in for loop? For example:
Size = 2
@constraint(
model,
[h in houses],
isCovered[h] <=
sum(
isAntenna[r, c]
for r in h[1] - Size:h[1] + Size, c in h[2] - Size:h[2] + Size
if 1 <= r <= M && 1 <= c <= N
)
)
Is it possible to make Size to be Int @variable? ...and if not, why?
Is it possible to make Size to be Int @variable?
No.
if not, why?
Sums have to be structural over a fixed number of elements. The values of the variables can change, but not the sparsity pattern of the summation.