Optimization, Python, Linear Optimization, Operations Research.
Constraint: sum of goods == customer demand for i in I: tmpExpression = pulp.LpAffineExpression(e = [(x[i,j], 1) for j in J if (i,j) in x]) tmpConstraint = pulp.LpConstraint(e = pulp.lpSum(tmpExpression), sense = pulp.LpConstraintEQ, rhs = d[i]) model.addConstraint(tmpConstraint) # Constraint: sum