I am new to Pyomo and python and am currently trying to build a MILP model. It'd be great if someone can help me out on this.
So in my production model, I have packing families,pf, and a packing line,l, can handle a packing family at a time. I also have a set of products, p.
In my model, capacity is reserved on a family level, so I want to construct sets in such a way that pf1 in set pf includes product p1,p2,p3,p4 and pf2 includes p5,p6,p7,p8. For instance, a constraint for implementing packing capacity restriction would be:
model.ct6rePackCap = ConstraintList()
for pf in model.PF for l in model.L for t in model.T for s in model.S for n in model.N:
lhs = sum(r[p,l,t,s,n] for p in model.P)
rhs = RPack[l,pf,t,s]
model.ct6reCap.add (lhs <= rhs)
Here r is the quantity of product with product index p and RPack is the capacity reserved for the packing family pf, to which each p belongs. How can I connect p and pf here such that each element of pf (pf1, pf2..) contains a set of products e.g. (pf1 = (p1,p2,p3,p4), pf2 =(p5,p6,p7,p8)) ?
I read pyomo document and read something about subset but it didn't seem like it would achieve what I want.
Thanks a lot in advance!