Large Random Min Cost Flow example 10/04/01 12:17:01 PAGE 1 GAMS Rev 121 Linux/Intel 2 4 option limrow=0, limcol=0, solprint=off; 5 6 set 7 nodes /1*5000/ 8 sources(nodes) 9 sinks(nodes); 10 11 alias (nodes,i,j,k); 12 13 set arcs(i,j); 14 parameter cost(i,j), supply(nodes), randomVector(nodes); 15 16 variables f(i,j), totalcost; 17 positive variable f; 18 19 scalar counter; 20 21 * first define a random set of arcs of a given density. 22 * (If density is too low, the problem may not have a solution - 23 * there may not be a path from sources to sinks.) 24 option seed=25671; 25 arcs(i,j) = yes$(uniform(0,1) < .025); 26 * no self-directed arcs 27 arcs(i,i) = no; 28 29 * now define costs on these arcs 30 cost(i,j) = uniform(0,50) $ arcs(i,j); 31 32 * determine eligible source nodes (those with outflowing arcs) 33 * and sinks (those with inflowing arcs); 34 sources(nodes) = no; sinks(nodes) = no; 35 loop(arcs(i,j), 36 sources(i) = yes; 37 sinks(j) = yes; 38 ); 39 40 supply(nodes) = 0; 41 * pick two sources to have positive supplies 42 counter = 0; 43 loop(nodes$(sources(nodes) and counter<2), 44 supply(nodes) = 10; 45 counter = counter+1; 46 ); 47 * and five sinks to have balancing negative supplies 48 counter = 0; 49 loop(nodes$(sinks(nodes) and counter<5 and supply(nodes)=0), 50 supply(nodes) = -4; 51 counter = counter+1; 52 ); 53 54 * display sources, sinks, supply; 55 56 equations balance(i), objective; 57 58 balance(i).. 59 sum(arcs(i,k), f(arcs)) - sum(arcs(j,i), f(arcs)) =e= supply(i); 60 objective.. 61 totalcost =e= sum(arcs, cost(arcs)*f(arcs)); 62 63 model mcf/balance, objective/; 64 65 solve mcf using lp minimizing totalcost; 66 67 option f:0:0:2; display f.l; 68 69 70 71 COMPILATION TIME = 0.010 SECONDS 0.7 Mb LNX200-121 Large Random Min Cost Flow example 10/04/01 12:17:01 PAGE 2 Model Statistics SOLVE mcf USING LP FROM LINE 65 GAMS Rev 121 Linux/Intel MODEL STATISTICS BLOCKS OF EQUATIONS 2 SINGLE EQUATIONS 5001 BLOCKS OF VARIABLES 2 SINGLE VARIABLES 625004 NON ZERO ELEMENTS 1875010 GENERATION TIME = 128.300 SECONDS 117.2 Mb LNX200-121 EXECUTION TIME = 179.070 SECONDS 117.2 Mb LNX200-121 Large Random Min Cost Flow example 10/04/01 12:17:01 PAGE 3 GAMS Rev 121 Linux/Intel S O L V E S U M M A R Y MODEL mcf OBJECTIVE totalcost TYPE LP DIRECTION MINIMIZE SOLVER CPLEX FROM LINE 65 **** SOLVER STATUS 1 NORMAL COMPLETION **** MODEL STATUS 1 OPTIMAL **** OBJECTIVE VALUE 78.7738 RESOURCE USAGE, LIMIT 29.490 1000.000 ITERATION COUNT, LIMIT 498 10000 GAMS/Cplex Mar 21, 2001 LNX.CP.CL 20.0 019.019.039.LNX For Cplex 7.0 Using environment variable ILOG_LICENSE_FILE to look for a Cplex license. Cplex 7.0.0, GAMS Link 19 Optimal solution found. Objective : 78.773790 **** REPORT SUMMARY : 0 NONOPT 0 INFEASIBLE 0 UNBOUNDED Large Random Min Cost Flow example 10/04/01 12:17:01 PAGE 4 E x e c u t i o n GAMS Rev 121 Linux/Intel ---- 67 VARIABLE f.L 1 .343 6, 1 .540 4 2 .593 10, 64 .1152 6 323 .3945 2, 324 .323 2 343 .64 6, 540 .896 4 593 .4950 10, 635 .4751 4 896 .635 4, 957 .1303 4 1076.3087 2, 1125.4 2 1152.2346 4, 1152.3755 2 1303.3368 4, 1649.6 4 1738.2779 4, 1746.957 4 1746.3683 4, 1957.1125 2 2314.2997 4, 2346.4181 4 2779.3536 4, 2997.7 4 3087.324 2, 3231.4128 4 3368.3 4, 3536.2314 4 3683.1738 4, 3755.4900 2 3945.4653 2, 4066.4 2 4128.5 4, 4181.3231 4 4346.1649 4, 4653.1957 2 4751.4346 4, 4900.4066 2 4950.1076 2, 4950.1746 8 EXECUTION TIME = 1.160 SECONDS 72.1 Mb LNX200-121 USER: Computer Sciences Dept. G010628:1627AS-LNX University of Wisconsin-Madison DC2621 **** FILE SUMMARY INPUT /afs/cs.wisc.edu/u/s/w/swright/public/html/635/examples/largenet.gms OUTPUT /afs/cs.wisc.edu/u/s/w/swright/public/html/635/examples/largenet.lst