I have two sets.
- S = Sources = {S1, S2, S3}
- D = Desinations = {D1, D2, D3}
I have to minimize the total transportation cost subject to some constraints. I am using the pulp in Python. How can I introduce a variable such that I am allowing some specific route?
The condition is if cost $(S_i, D_j) >=$ 250 then 0 else 1.
allowed_route = []
for i in range(len(matrix)):
for j in matrix[i]:
if j >= 250:
allowed_route.append(0)
else:
allowed_route.append(1)
np_array=np.asarray(allowed_route)
allowed_route = np_array.reshape(6, 4)
allowed_route = np.array(P_allowed_PLF_cap).tolist()
In this way, I have defined the parameter but I am unable to introduce the variable.