I have a problem with adding three expressions in my objective function. I used quicksum to build each expression. However, when I try to add them together I get an error that I cannot use +/- operands on class 'generator'.
Here is the last part of my code:
# the shipping cost expression
expr_sc = []
for j in J:
for k in K:
expr_sc.append(quicksum(r_jk[(j, k)]*x[(i, j, k)]) for i in I)
m.setObjective((quicksum(item_rev) for item_rev in expr_rev) -
((quicksum(item_pc) for item_pc in expr_pc) + (quicksum(item_sc) for item_sc in expr_sc)),
GRB.MAXIMIZE)
Update:
here is the actual problem that I am trying to solve: Objective Function The problem is I don't know how to write this expression in Gurobi Python!!