generators/netgen/netgen.c
changeset 10 d7ce0311ece2
parent 6 a3ef33a8694a
equal deleted inserted replaced
0:641792c7aa19 1:1ebf172c819d
    83 /*** Public interfaces */
    83 /*** Public interfaces */
    84 
    84 
    85 #define ALLOCATE_NETWORK
    85 #define ALLOCATE_NETWORK
    86 #include "netgen.h"
    86 #include "netgen.h"
    87 
    87 
    88 #define PROBLEM_PARMS 13		/* aliases for generation parameters */
    88 #include "main.h"
    89 #define NODES	    parms[0]		/* number of nodes */
       
    90 #define SOURCES     parms[1]		/* number of sources (including transshipment) */
       
    91 #define SINKS	    parms[2]		/* number of sinks (including transshipment) */
       
    92 #define DENSITY     parms[3]		/* number of (requested) arcs */
       
    93 #define MINCOST     parms[4]		/* minimum cost of arcs */
       
    94 #define MAXCOST     parms[5]		/* maximum cost of arcs */
       
    95 #define SUPPLY	    parms[6]		/* total supply */
       
    96 #define TSOURCES    parms[7]		/* transshipment sources */
       
    97 #define TSINKS	    parms[8]		/* transshipment sinks */
       
    98 #define HICOST	    parms[9]		/* percent of skeleton arcs given maximum cost */
       
    99 #define CAPACITATED parms[10]		/* percent of arcs to be capacitated */
       
   100 #define MINCAP	    parms[11]		/* minimum capacity for capacitated arcs */
       
   101 #define MAXCAP	    parms[12]		/* maximum capacity for capacitated arcs */
       
   102 
       
   103 
    89 
   104 /*** Private interfaces */
    90 /*** Private interfaces */
   105 
    91 
   106 #ifdef DEBUG
    92 #ifdef DEBUG
   107 #define PRIVATE
    93 #define PRIVATE
   483 			break;							\
   469 			break;							\
   484 		default:							\
   470 		default:							\
   485 			exit(0);						\
   471 			exit(0);						\
   486 		}
   472 		}
   487 
   473 
   488 int main()
   474 int orig_main(long seed,long problem,long *parms)
   489 {
   475 {
   490   long seed;
       
   491   long problem;
       
   492   long parms[PROBLEM_PARMS];
       
   493   long arcs;
   476   long arcs;
   494   int i;
   477   int i;
   495 
   478 
   496 /*** Read problem parameters and generate networks */
   479 /*** Read problem parameters and generate networks */
   497 
   480   {
   498   while (1) {
       
   499     READ(seed);
       
   500     if (seed <= 0) exit(0);
       
   501     READ(problem);
       
   502     if (problem <= 0) exit(0);
       
   503     for (i = 0; i < PROBLEM_PARMS; i++)
       
   504       READ(parms[i]);
       
   505     printf("c NETGEN flow network generator (C version)\n");
   481     printf("c NETGEN flow network generator (C version)\n");
   506     printf("c  Problem %2ld input parameters\n", problem);
   482     printf("c  Problem %2ld input parameters\n", problem);
   507     printf("c  ---------------------------\n");
   483     printf("c  ---------------------------\n");
   508     printf("c   Random seed:          %10ld\n",   seed);
   484     printf("c   Random seed:          %10ld\n",   seed);
   509     printf("c   Number of nodes:      %10ld\n",   NODES);
   485     printf("c   Number of nodes:      %10ld\n",   NODES);