I am trying to create an indexed variable in pyomo, but I want to sets the bounds of the various indexes differently like this:
model.vProduct = Var(SC, N, G, bounds=(0, limit[g])
Where SC, N and G are ranges so it has 3 indexes. (Which dos not work because like this I am assigning a vector of upper bounds to each variable)
Now I want it to be like model.vProduct[SC, N, 0] bounds are (0, limit[0])
etc.
Does anybody know how to solve this issue?
You can pass a rule (a.k.a. a Python function) to the bounds keyword to do this
def _bounds_rule(m, sc, n, g):
return (0, limit[g])
model.vProduct = Var(SC, N, G, bounds=_bounds_rule)