I am trying to do linear constraint optimisation as follows:
model = Model(Tulip.Optimizer)
# Set up variables
@variable(model, x[1:length(VecA)+length(VecB)])
# set up linear constraints
workingweights = x' * Mat' + VecC'
# Equalities
for i in 1:length(VecA)
@constraint(model, workingweights * Mat[:,i] == VecA[i])
end
# Inequalities
for i in 1:length(VecB)
xi = i+length(VecB)
@constraint(model, workingweights * Mat[:,i] <= VecB[i])
end
optimize!(model)
Here, Mat
is a matrix, and VecA
, VecB
, and VecC
are vectors. The problem is I am getting the “addition operator has been used on JuMP expressions a large number of times…” I imagine the issue is in either the definition of workingweights
or the @constraints
declarations, but I am unsure how to fix this. This code is central in my program, and optimising this would help a lot.