'LP summation issue with pulp
I have imported an Excel file to python using
pandas.read_excel and changed it to a Dataframe using pandas.DataFrame.
Table Ingredients
I have defined variables using:
x = pulp.LpVariable.dicts("Ingr", ((i) for i in data_df['Ingredients']), lowBound=0)
I want to write a summation which is basically costs[i] * x[i]. I have difficulty indexing costs over ingredients
prob += lpSum(x[i]*data_df['costs'][i] for i in data_df)
Any help is appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
