2 *** Prototype code for inclusion into network generation routines
5 /*** Constant definitions */
11 #define BAD_SEED -1 /* error indicators */
14 #define ALLOCATION_FAILURE -4
17 /*** Type definitions */
19 typedef unsigned long NODE; /* node number */
20 typedef unsigned long ARC; /* arc number */
21 typedef long CAPACITY; /* arc capacity */
22 typedef long COST; /* arc cost */
23 typedef unsigned long INDEX; /* index element */
24 typedef int INDEX_LIST; /* index list handle */
27 /*** Function prototypes */
34 void netgen_(long*, long[], long*, long*); /* Fortran external interface */
35 ARC netgen(long, long*); /* C external interface */
37 INDEX_LIST make_index_list(INDEX, INDEX); /* allocates a new index list */
38 void free_index_list(INDEX_LIST); /* frees an existing list */
39 INDEX choose_index(INDEX_LIST, INDEX); /* chooses index at specified position */
40 void remove_index(INDEX_LIST, INDEX); /* removes specified index from list */
41 INDEX index_size(INDEX_LIST); /* number of indices remaining */
42 INDEX pseudo_size(INDEX_LIST); /* "modified" index size */
44 void set_random(long); /* initialize random seed */
45 long ng_random(long, long); /* generate random integer in interval */
49 void *malloc(); /* some standard header should define this */
50 void *realloc(); /* ditto */
51 void free(); /* ditto */
52 void *memset(); /* ditto */
53 void exit(); /* ditto */
55 void netgen_(); /* Fortran external interface */
56 ARC netgen(); /* C external interface */
58 INDEX_LIST make_index_list(); /* allocates a new index list */
59 void free_index_list(); /* frees an existing list */
60 INDEX choose_index(); /* chooses index at specified position */
61 void remove_index(); /* removes specified index from list */
62 INDEX index_size(); /* number of indices remaining */
63 INDEX pseudo_size(); /* "modified" index size */
65 void set_random(); /* initialize random seed */
66 long ng_random(); /* generate random integer in interval */
70 /*** To maintain compatibility with the old Fortran network generator,
71 *** the following are defined. This allows linking the generator code
72 *** with the solver, with the generated network passed to the solver
73 *** through arrays in memory.
76 #define MAXNODES 10000000 /* maximum problem sizes */
77 #define MAXARCS 40000000
79 #define FROM arrays_ /* aliases for network storage */
85 #ifdef ALLOCATE_NETWORK /* storage definitions */
91 EXTERN NODE FROM[MAXARCS]; /* origin of each arc */
92 EXTERN NODE TO [MAXARCS]; /* destination */
93 EXTERN CAPACITY U [MAXARCS]; /* capacity */
94 EXTERN COST C [MAXARCS]; /* cost */
95 EXTERN CAPACITY B [MAXNODES]; /* supply (demand) at each node */