set ORIG; # origins set DEST; # destinations set PROD; # products param supply {ORIG,PROD} >= 0; # prod.capacity 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; param trans_cost {PROD} >= 0; # trans_costs per unit & km in 1000 DM param dist {ORIG,DEST} >= 0; # distances in km param make_cost {ORIG,PROD} >= 0; # make cost in 1000 DM param sales_price {DEST,PROD} >= 0; # sales price per car in 1000 DM var Trans {ORIG,DEST,PROD} >= 0; # 1000 units to be shipped var revenue; # in 1000 DM var total_make_cost; # in 1000 DM var total_trans_cost; # in 1000 DM maximize profit: revenue - total_make_cost - total_trans_cost; subject to Revenue: sum {i in ORIG,j in DEST,k in PROD} sales_price[j,k] * 1000*Trans[i,j,k]=revenue; subject to Total_make_cost: sum {i in ORIG,j in DEST,k in PROD} make_cost [i,k] * 1000*Trans[i,j,k]=total_make_cost; subject to Total_trans_cost : sum {i in ORIG,j in DEST,k in PROD} trans_cost[k] * 1000*Trans[i,j,k] *dist[i,j]=total_trans_cost; subject to Supply {i in ORIG, p in PROD}: sum {j in DEST} Trans[i,j,p] = supply[i,p]; subject to Demand {j in DEST, p in PROD}: sum {i in ORIG} Trans[i,j,p] = demand[j,p];