$ondollar title Building Evacuation (NF) Example 10.4 of Rardin (1998) $offsymxref offsymlist offuelxref offuellist offupper option limrow = 0, limcol = 0; option lp = bdmlp; set i "nodes" /1*10/; alias (i,j); alias (i,k); set arc(i,j) "arc set of the digraph" /1.2, 1.4, 1.6, 1.8, 2.3, 3.2, 3.4, 4.3, 4.5, 5.4, 5.6, 6.5, 6.7, 7.6, 7.8, 8.7, 8.9, 9.8, 9.2, 2.9, 2.10, 3.10, 5.10, 7.10, 9.10, 10.1/; parameter u(i,j) "arc capacities" /1.2 600, 1.4 600, 1.6 600, 1.8 600, 2.3 350, 3.2 350, 3.4 350, 4.3 350, 4.5 350, 5.4 350, 5.6 350, 6.5 350, 6.7 350, 7.6 350, 7.8 350, 8.7 350, 8.9 350, 9.8 350, 9.2 350, 2.9 350, 2.10 800, 3.10 400, 5.10 400, 7.10 400, 9.10 400, 10.1 10000/; free variable maxf "maximum flow"; positive variables x(i,j) "flow on arc (i,j)"; equations obj "maximize flow", bal(k) "balance of flow at node k", cap(i,j) "arc capacities"; obj.. maxf =e= x('10','1'); bal(k).. sum(i$arc(i,k), x(i,k)) - sum(j$arc(k,j), x(k,j)) =e= 0; cap(i,j)$arc(i,j).. x(i,j) =l= u(i,j); model bldgevac /all/; solve bldgevac using lp maximizing maxf;