$title max flow problem $ontext The Hatfields, Montagues, McCoys and Capulets are going on their annual family picnic. Four cars are available to transport the families to the picnic. The cars can carry the following numbers of people: car 1, 4; car 2, 3; car 3, 3; car 4, 4. There are four people in each family, and no car can carry more than two people from any one family. Determine the maximum number of people that can be transported to the picnic. $offtext *$ontext set family /hatfield,montague,mccoy,capulet/; set car /car1*car4/; parameter cap(car) /car1 4, car2 3, car3 3, car4 4/; parameter famsize(family); famsize(family) = 4; parameter perFam(family); perFam(family) = 2; *$offtext $ontext * Try a big one? set family /1*500/; set car /1*500/; parameter cap(car); parameter famsize(family); parameter perFam(family); cap(car) = round(uniform(2,5)); famSize(family) = max(1,round(normal(4,2))); perFam(family) = 2; $offtext positive variables flow(family,car) Number of people from family in car source_fam(family) Flow from source to family node car_sink(car) Number of people from car to sink ; variable totgo total people going to picnic; equations defobj, car_bal(car), family_bal(family); defobj.. totgo =e= sum(family, source_fam(family)); family_bal(family).. source_fam(family) =E= sum(car, flow(family,car)); car_bal(car).. car_sink(car) =E= sum(family, flow(family,car)); source_fam.up(family) = famSize(family); flow.up(family,car) = perFam(family); car_sink.up(car) = cap(car); model maxflow /all/; option lp=cplex; solve maxflow using lp max totgo; parameter cplexlp; cplexlp = maxflow.resusd; * use network simplex method (in option file) $onecho > cplex.opt lpmethod 3 netfind 2 preind 0 $offecho maxflow.optfile = 1; solve maxflow using lp max totgo; parameter cplexnet; cplexnet = maxflow.resusd; option lp=CoinGlpk; maxflow.optfile = 0; solve maxflow using lp max totgo; parameter glpk; glpk = maxflow.resusd; display cplexlp, cplexnet, glpk;