Add constraints for fixed plants in garden

This commit is contained in:
Dimitri Lozeve 2020-02-23 22:20:10 +01:00
parent fc1d2eb792
commit 43b7526497

View file

@ -30,7 +30,7 @@ function neighbourmatrix(mask::Matrix)::Matrix{Bool}
d d
end end
function definemodel(plantcounts::Vector, mask::Matrix, costs::Matrix) function definemodel(plantcounts::Vector, garden::Matrix, mask::Matrix, costs::Matrix)
N = length(mask) N = length(mask)
Q = size(costs, 1) Q = size(costs, 1)
@ -57,6 +57,9 @@ function definemodel(plantcounts::Vector, mask::Matrix, costs::Matrix)
@constraint(model, x[i, q] == 0) @constraint(model, x[i, q] == 0)
end end
end end
if garden[i] != 0
@constraint(model, x[i, garden[i]] == 1)
end
end end
for q = 1:Q for q = 1:Q