Try our new documentation site (beta).
Filter Content By
Version
Text Search
${sidebar_list_label} - Back
Filter by Language
Flow conservation constraints
The next set of constraints are the flow conservation constraints. They require that, for each commodity and node, the sum of the flow into the node plus the quantity of external inflow at that node must be equal to the sum of the flow out of the node:
for h in commodities: for j in nodes: m.addConstr( quicksum(flow[h,i,j] for i,j in arcs.select('*',j)) + inflow[h,j] == quicksum(flow[h,j,k] for j,k in arcs.select(j,'*')), 'node_%s_%s' % (h, j))