Im trying to set up a linear programming problem that involves 3 plants and 4 distribution centers. The goal is to minimize the cost but each plant distribution center combo has a different cost associated.
Is there a better way to create variables either with pulp or another library so I don't have to write so many. Currently mine look like this.
from pulp import *
#define the problem
prob=LpProblem('transportation', LpMinimize)
#create Variables
plant1_center1 = LpVariable('plant1_center1', lowBound=0, cat='Integer')
plant1_center2 = LpVariable('plant1_center2', lowBound=0, cat='Integer')
plant1_center3 = LpVariable('plant1_center3', lowBound=0, cat='Integer')
plant1_center4 = LpVariable('plant1_center4', lowBound=0, cat='Integer')
plant2_center1 = LpVariable('plant2_center1', lowBound=0, cat='Integer')
plant2_center2 = LpVariable('plant2_center2', lowBound=0, cat='Integer')
plant2_center3 = LpVariable('plant2_center3', lowBound=0, cat='Integer')
plant2_center4 = LpVariable('plant2_center4', lowBound=0, cat='Integer')
plant3_center1 = LpVariable('plant3_center1', lowBound=0, cat='Integer')
plant3_center2 = LpVariable('plant3_center2', lowBound=0, cat='Integer')
plant3_center3 = LpVariable('plant3_center3', lowBound=0, cat='Integer')
plant3_center4 = LpVariable('plant3_center4', lowBound=0, cat='Integer')
It works but I hate having to create a variable like this every time.