'Multi Product Linear Programming Optimization with Pulp

I have a Multiple production LP optimization problem in which the product(B1,B2,D) will be received in variable quantity with respect to date column, the Optimizer should give the Min_Capacity Max_Capacity to be planned on every day LP variable are Assy Out B1 , Assy Out B2 , Assy Out D , Open Assy Line(Binary decision to produce or not in given date) The target to maximize the assembly output per day and the constraints are material receipt for each date and not allowed to produce more than material available in each date Tried the problem in Excel its working fine but unable to fix the model in Pulp , as my real data have more than 200 variable which is not feasible in excel sheet

enter image description here

x=np.arange(1,10)

Assy_B1=pulp.LpVariable.dicts('Assy_B1',x,0,None,'Integer')

Assy_B2=pulp.LpVariable.dicts('Assy_B2',x,0,None,'Integer')
Assy_D=pulp.LpVariable.dicts('Assy_D',x,0,None,'Integer')
Open_Line=pulp.LpVariable.dicts('Open_Line',x,0,None,'Binary')
model=LpProblem('Assembly_Plan',LpMaximize)

model +=lpSum([ Assy_B1[t] + Assy_B2[t] + Assy_D[t] for t in x])

for i in x:
    model+=(Assy_B1[i]+Assy_B2[i]+Assy_D[i])<=dfs.loc[i,'Max_Capacity ']*Open_Line[i])

model.solve()

 Status Optimal 

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source