I have a basic question as I am new to both Python and Pyomo. I have set a constraint that works properly to set the sum of the elements in array equal to 1.
def Allocation(model):
return sum(model.alloc[i] for i in model.alloc) == 1
model.allocationSum = Constraint(rule=Allocation)
What must I do to then have each element of the array be greater than or equal to 0.01? The following did not work:
def allocationMinimum(model):
for i in model.alloc
return model.alloc[i] >= 0.01
model.minimumWeight = Constraint(rule=allocationMinimum)
Thanks.