Hello Everyone,
I am working on a linear programming problem for which I am creating lower bounds and upper bounds for each variable using for loop and pushing it into an array. I have a total of 5489 variables.
M = Model()
set_optimizer(M, HiGHS.Optimizer)
lb = []
ub = []
for i in 1:shapeOfMat[1]
for j in 1:shapeOfMat[2]
if datecolMatrix[i, j] == 1
if condition
bound = *
push!(lb, bound)
push!(ub, bound)
else
if condition
ubound = *
push!(lb, 1)
push!(ub, ubound)
else
lowerBound = *
upperBound = *
push!(lb, lowerBound)
push!(ub, upperBound)
end
end
end
end
end
# Define the variables
@variable(M, lb[i] <= y[i = 1:len] <= ub[i])
For the above code I am getting :-
At In[31]:57: @variable(M, ub[i] >= y[i = 1:len] >= lb[i])
: Passing arrays as variable bounds without indexing them is not supported.
Instead of:
@variable(model, x[1:2] >= lb)
use
@variable(model, x[i=1:2] >= lb[i])
or
@variable(model, x[1:2])
set_lower_bound.(x, lb)