KeyError showing on Pulp program

Viewed 22

I have this restriction on a Linear Programming problem:

problema += sum(bultos[i]*folioubi.loc[i,j]*x[i][j] for i in folios for j in ubicaciones) == w['Directa']

But the program stops here and shows the following error: KeyError: 'Directa'

I'm defining the w variable as the following:

w = pulp.LpVariable.dicts('Total de bultos por tipo de recolección r',(tiporec),lowBound=0, cat='Integer')

Is this correct? It needs to be an Integer variable but I don't know why the key error is showing.

0 Answers
Related