I am trying to formulate an objective function for cost optimization in PuLP wherein the maximum of an array is added to the objective function. Please ignore the indentation.
#Decision Variables
allocation_vars = LpVariable.dicts(
'Allocation',
[(i,j,k) for i in TruckTypes for j in Days for k in RS],
0,
LpInteger
)
#Objective Function
for i in TruckTypes:
for j in Days:
prob += max(allocation_vars[(i, j, k)] * TransCost[i][k] for k in RS)
I am getting the following error when trying to run the above :
prob += max(allocation_vars[(i, j, k)] * TransCost[i][k] for k in RS)
TypeError: '>' not supported between instances of 'LpAffineExpression' and 'LpAffineExpression'