set ORIG; # origins set DEST; # destinations set PROD; # products param supply {ORIG,PROD} >= 0; # amounts available at origins param demand {DEST,PROD} >= 0; # amounts required at destinations check {p in PROD}: sum {i in ORIG} supply[i,p] = sum {j in DEST} demand[j,p]; param limit {ORIG,DEST} >= 0; # maximum shipments on routes param minload >= 0; # minimum nonzero shipment param maxserve integer > 0; # maximum destinations served param vcost {ORIG,DEST,PROD} >= 0; # variable shipment cost on routes var Trans {ORIG,DEST,PROD} >= 0; # units to be shipped param fcost {ORIG,DEST} >= 0; # fixed cost for using a route var Use {ORIG,DEST} binary; # = 1 only for routes used minimize Total_Cost: sum {i in ORIG, j in DEST, p in PROD} vcost[i,j,p] * Trans[i,j,p] + sum {i in ORIG, j in DEST} fcost[i,j] * Use[i,j]; subject to Supply {i in ORIG, p in PROD}: sum {j in DEST} Trans[i,j,p] = supply[i,p]; subject to Max_Serve {i in ORIG}: sum {j in DEST} Use[i,j] <= maxserve; subject to Demand {j in DEST, p in PROD}: sum {i in ORIG} Trans[i,j,p] = demand[j,p]; subject to Multi {i in ORIG, j in DEST}: sum {p in PROD} Trans[i,j,p] <= limit[i,j] * Use[i,j]; subject to Min_Ship {i in ORIG, j in DEST}: sum {p in PROD} Trans[i,j,p] >= minload * Use[i,j];