COIN-OR::LEMON - Graph Library

source: lemon-benchmark/generators/netgen/netgen.h @ 9:7768d68909e8

Last change on this file since 9:7768d68909e8 was 6:a3ef33a8694a, checked in by Alpar Juttner <alpar@…>, 14 years ago

Add netgen generator

File size: 2.9 KB
Line 
1/*** netgen.h
2 *** Prototype code for inclusion into network generation routines
3 ***/
4
5/*** Constant definitions */
6
7#ifndef NULL
8#define NULL 0
9#endif
10
11#define BAD_SEED  -1                    /* error indicators */
12#define TOO_BIG   -2
13#define BAD_PARMS -3
14#define ALLOCATION_FAILURE -4
15
16
17/*** Type definitions */
18
19typedef unsigned long NODE;             /* node number */
20typedef unsigned long ARC;              /* arc number */
21typedef long CAPACITY;                  /* arc capacity */
22typedef long COST;                      /* arc cost */
23typedef unsigned long INDEX;            /* index element */
24typedef int INDEX_LIST;                 /* index list handle */
25
26
27/*** Function prototypes */
28
29#ifdef __STDC__
30
31#include <stdlib.h>
32#include <string.h>
33
34void netgen_(long*, long[], long*, long*);      /* Fortran external interface */
35ARC netgen(long, long*);                        /* C external interface */
36
37INDEX_LIST make_index_list(INDEX, INDEX); /* allocates a new index list */
38void free_index_list(INDEX_LIST);       /* frees an existing list */
39INDEX choose_index(INDEX_LIST, INDEX);  /* chooses index at specified position */
40void remove_index(INDEX_LIST, INDEX);   /* removes specified index from list */
41INDEX index_size(INDEX_LIST);           /* number of indices remaining */
42INDEX pseudo_size(INDEX_LIST);          /* "modified" index size */
43
44void set_random(long);                  /* initialize random seed */
45long ng_random(long, long);             /* generate random integer in interval */
46
47#else
48
49void *malloc();                         /* some standard header should define this */
50void *realloc();                        /* ditto */
51void free();                            /* ditto */
52void *memset();                         /* ditto */
53void exit();                            /* ditto */
54
55void netgen_();                         /* Fortran external interface */
56ARC netgen();                           /* C external interface */
57
58INDEX_LIST make_index_list();           /* allocates a new index list */
59void free_index_list();                 /* frees an existing list */
60INDEX choose_index();                   /* chooses index at specified position */
61void remove_index();                    /* removes specified index from list */
62INDEX index_size();                     /* number of indices remaining */
63INDEX pseudo_size();                    /* "modified" index size */
64
65void set_random();                      /* initialize random seed */
66long ng_random();                       /* generate random integer in interval */
67
68#endif
69
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.
74 ***/
75
76#define MAXNODES   10000000             /* maximum problem sizes */
77#define MAXARCS    40000000
78
79#define FROM arrays_                    /* aliases for network storage */
80#define TO   arraye_
81#define U    arrayu_
82#define C    arrayc_
83#define B    arrayb_
84
85#ifdef ALLOCATE_NETWORK                 /* storage definitions */
86#define EXTERN
87#else
88#define EXTERN extern
89#endif
90
91EXTERN NODE     FROM[MAXARCS];  /* origin of each arc */
92EXTERN NODE     TO  [MAXARCS];  /* destination */
93EXTERN CAPACITY U   [MAXARCS];  /* capacity */
94EXTERN COST     C   [MAXARCS];  /* cost */
95EXTERN CAPACITY B   [MAXNODES]; /* supply (demand) at each node */
Note: See TracBrowser for help on using the repository browser.