You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
5.4 KiB

2 months ago
  1. /* netgen.c */
  2. /* This main program generates 50 original NETGEN instances of the
  3. minimum cost flow problem and writes them in DIMACS format to the
  4. current directory. */
  5. #include <stddef.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <glpk.h>
  9. static int parm[50][15] =
  10. { {13502460, 101,
  11. 5000, 2500, 2500, 25000, 1, 100, 250000, 0, 0, 0, 100, 1, 1000,
  12. },{4281922, 102,
  13. 5000, 2500, 2500, 25000, 1, 100, 2500000, 0, 0, 0, 100, 1, 1000,
  14. },{44820113, 103,
  15. 5000, 2500, 2500, 25000, 1, 100, 6250000, 0, 0, 0, 100, 1, 1000,
  16. },{13450451, 104,
  17. 5000, 2500, 2500, 25000, -100, -1, 250000, 0, 0, 0, 100, 1, 1000,
  18. },{14719436, 105,
  19. 5000, 2500, 2500, 25000, 101, 200, 250000, 0, 0, 0, 100, 1, 1000,
  20. },{17365786, 106,
  21. 5000, 2500, 2500, 12500, 1, 100, 125000, 0, 0, 0, 100, 1, 1000,
  22. },{19540113, 107,
  23. 5000, 2500, 2500, 37500, 1, 100, 375000, 0, 0, 0, 100, 1, 1000,
  24. },{19560313, 108,
  25. 5000, 2500, 2500, 50000, 1, 100, 500000, 0, 0, 0, 100, 1, 1000,
  26. },{2403509, 109,
  27. 5000, 2500, 2500, 75000, 1, 100, 750000, 0, 0, 0, 100, 1, 1000,
  28. },{92480414, 110,
  29. 5000, 2500, 2500, 12500, 1, 100, 250000, 0, 0, 0, 100, 1, 1000,
  30. },{4230140, 111,
  31. 5000, 2500, 2500, 37500, 1, 100, 250000, 0, 0, 0, 100, 1, 1000,
  32. },{10032490, 112,
  33. 5000, 2500, 2500, 50000, 1, 100, 250000, 0, 0, 0, 100, 1, 1000,
  34. },{17307474, 113,
  35. 5000, 2500, 2500, 75000, 1, 100, 250000, 0, 0, 0, 100, 1, 1000,
  36. },{4925114, 114,
  37. 5000, 500, 4500, 25000, 1, 100, 250000, 0, 0, 0, 100, 1, 1000,
  38. },{19842704, 115,
  39. 5000, 1500, 3500, 25000, 1, 100, 250000, 0, 0, 0, 100, 1, 1000,
  40. },{88392060, 116,
  41. 5000, 2500, 2500, 25000, 1, 100, 250000, 0, 0, 0, 0, 1, 1000,
  42. },{12904407, 117,
  43. 5000, 2500, 2500, 12500, 1, 100, 125000, 0, 0, 0, 0, 1, 1000,
  44. },{11811811, 118,
  45. 5000, 2500, 2500, 37500, 1, 100, 375000, 0, 0, 0, 0, 1, 1000,
  46. },{90023593, 119,
  47. 5000, 2500, 2500, 50000, 1, 100, 500000, 0, 0, 0, 0, 1, 1000,
  48. },{93028922, 120,
  49. 5000, 2500, 2500, 75000, 1, 100, 750000, 0, 0, 0, 0, 1, 1000,
  50. },{72707401, 121,
  51. 5000, 50, 50, 25000, 1, 100, 250000, 50, 50, 0, 100, 1, 1000,
  52. },{93040771, 122,
  53. 5000, 250, 250, 25000, 1, 100, 250000, 250, 250, 0, 100, 1, 1000,
  54. },{70220611, 123,
  55. 5000, 500, 500, 25000, 1, 100, 250000, 500, 500, 0, 100, 1, 1000,
  56. },{52774811, 124,
  57. 5000, 1000, 1000, 25000, 1, 100, 250000, 1000, 1000, 0, 100, 1,
  58. 1000,
  59. },{22492311, 125,
  60. 5000, 1500, 1500, 25000, 1, 100, 250000, 1500, 1500, 0, 100, 1,
  61. 1000,
  62. },{35269337, 126,
  63. 5000, 500, 500, 12500, 1, 100, 125000, 500, 500, 0, 100, 1, 1000,
  64. },{30140502, 127,
  65. 5000, 500, 500, 37500, 1, 100, 375000, 500, 500, 0, 100, 1, 1000,
  66. },{49205455, 128,
  67. 5000, 500, 500, 50000, 1, 100, 500000, 500, 500, 0, 100, 1, 1000,
  68. },{42958341, 129,
  69. 5000, 500, 500, 75000, 1, 100, 750000, 500, 500, 0, 100, 1, 1000,
  70. },{25440925, 130,
  71. 5000, 500, 500, 12500, 1, 100, 250000, 500, 500, 0, 100, 1, 1000,
  72. },{75294924, 131,
  73. 5000, 500, 500, 37500, 1, 100, 250000, 500, 500, 0, 100, 1, 1000,
  74. },{4463965, 132,
  75. 5000, 500, 500, 50000, 1, 100, 250000, 500, 500, 0, 100, 1, 1000,
  76. },{13390427, 133,
  77. 5000, 500, 500, 75000, 1, 100, 250000, 500, 500, 0, 100, 1, 1000,
  78. },{95250971, 134,
  79. 1000, 500, 500, 25000, 1, 100, 250000, 500, 500, 0, 100, 1, 1000,
  80. },{54830522, 135,
  81. 2500, 500, 500, 25000, 1, 100, 250000, 500, 500, 0, 100, 1, 1000,
  82. },{520593, 136,
  83. 7500, 500, 500, 25000, 1, 100, 250000, 500, 500, 0, 100, 1, 1000,
  84. },{52900925, 137,
  85. 10000, 500, 500, 25000, 1, 100, 250000, 500, 500, 0, 100, 1, 1000,
  86. },{22603395, 138,
  87. 5000, 500, 500, 25000, 1, 100, 250000, 500, 500, 0, 100, 1, 50,
  88. },{55253099, 139,
  89. 5000, 500, 500, 25000, 1, 100, 250000, 500, 500, 0, 100, 1, 250,
  90. },{75357001, 140,
  91. 5000, 500, 500, 25000, 1, 100, 250000, 500, 500, 0, 100, 1, 500,
  92. },{10072459, 141,
  93. 5000, 500, 500, 25000, 1, 100, 250000, 500, 500, 0, 100, 1, 2500,
  94. },{55728492, 142,
  95. 5000, 500, 500, 25000, 1, 100, 250000, 500, 500, 0, 100, 1, 5000,
  96. },{593043, 143,
  97. 5000, 500, 500, 25000, 1, 100, 250000, 500, 500, 0, 0, 1, 1000,
  98. },{94236572, 144,
  99. 5000, 500, 500, 25000, 1, 10, 250000, 500, 500, 0, 100, 1, 1000,
  100. },{94882955, 145,
  101. 5000, 500, 500, 25000, 1, 1000, 250000, 500, 500, 0, 100, 1, 1000,
  102. },{48489922, 146,
  103. 5000, 500, 500, 25000, 1, 10000, 250000, 500, 500, 0, 100, 1,
  104. 1000,
  105. },{75578374, 147,
  106. 5000, 500, 500, 25000, -100, -1, 250000, 500, 500, 0, 100, 1,
  107. 1000,
  108. },{44821152, 148,
  109. 5000, 500, 500, 25000, -50, 49, 250000, 500, 500, 0, 100, 1, 1000,
  110. },{45224103, 149,
  111. 5000, 500, 500, 25000, 101, 200, 250000, 500, 500, 0, 100, 1,
  112. 1000,
  113. },{63491741, 150,
  114. 5000, 500, 500, 25000, 1001, 1100, 250000, 500, 500, 0, 100, 1,
  115. 1000,
  116. }
  117. };
  118. typedef struct { double rhs; } v_data;
  119. typedef struct { double cap, cost; } a_data;
  120. int main(void)
  121. { glp_graph *G;
  122. int k;
  123. char fname[100+1];
  124. G = glp_create_graph(sizeof(v_data), sizeof(a_data));
  125. for (k = 1; k <= 50; k++)
  126. { sprintf(fname, "netgn%03d.min", parm[k-1][1]);
  127. glp_netgen(G, offsetof(v_data, rhs), offsetof(a_data, cap),
  128. offsetof(a_data, cost), &parm[k-1][-1]);
  129. glp_write_mincost(G, offsetof(v_data, rhs), -1,
  130. offsetof(a_data, cap), offsetof(a_data, cost), fname);
  131. }
  132. glp_delete_graph(G);
  133. return 0;
  134. }
  135. /* eof */