Dip  0.92.4
network.h
Go to the documentation of this file.
1 /*===========================================================================*/
2 /* */
3 /* This file is part of a demonstration application for use with the */
4 /* SYMPHONY Branch, Cut, and Price Library. This application is a solver for */
5 /* the Vehicle Routing Problem and the Traveling Salesman Problem. */
6 /* */
7 /* (c) Copyright 2000-2013 Ted Ralphs. All Rights Reserved. */
8 /* */
9 /* This application was developed by Ted Ralphs (ted@lehigh.edu) */
10 /* */
11 /* This software is licensed under the Eclipse Public License. Please see */
12 /* accompanying file for terms. */
13 /* */
14 /*===========================================================================*/
15 
16 #ifndef _NETWORK
17 #define _NETWORK
18 
19 /* SYMPHONY include files */
20 #include "sym_proto.h"
21 
22 /* VRP include files */
23 #include "vrp_const.h"
24 
25 #define NOT_INTEGRAL -1
26 #define OTHER_END(cur_edge, v) \
27  (cur_edge->data->v0 == v) ? cur_edge->data->v1 : cur_edge->data->v0
28 
29 /*-----------------------------------------------------------------------*\
30 | These are data tructures used in constructing the solution graph used |
31 | by the cut generator to locate cuts. The graph is stored using |
32 | adjacency lists |
33 \*-----------------------------------------------------------------------*/
34 
35 typedef struct EDGE{
36  int v0;
37  int v1;
38  int cost;
39  double weight;
40  char scanned;
41  char tree_edge;
42  char deleted;
43  /*__BEGIN_EXPERIMENTAL_SECTION__*/
44  float q;
45  int row;
46  char can_be_doubled; /* tells whether this edge can potentially be used
47  for a 1-customer route */
48  struct EDGE *other_data;
49 #ifdef COMPILE_OUR_DECOMP
50  char status;
51 #endif
52  /*___END_EXPERIMENTAL_SECTION___*/
53 }edge;
54 
55 typedef struct ELIST{
56  struct ELIST *next_edge; /* next edge in the edgelist */
57  struct EDGE *data; /* the data of the edge */
58  int other_end; /* the other end of the edge */
59  struct VERTEX *other;
60  /*__BEGIN_EXPERIMENTAL_SECTION__*/
61  char superlink;
62  int edgenum;
63  struct EDGE **edges;
64  /*___END_EXPERIMENTAL_SECTION___*/
65 }elist;
66 
67 typedef struct VERTEX{
68  int enodenum; /* the node number in the contracted graph */
69  int orignodenum;/* the node number in the original graph */
70  struct ELIST *first; /* points to the first edge in the adjacency list */
71  struct ELIST *last; /* points to the last edge in the adjacency list */
72  int comp; /* contains the component number if the graph is
73  disconnected */
74  char scanned;
75  int demand; /* contains the demand for this node */
76  int degree; /* contains the degree of the node in the graph */
78  int *orig_node_list; /* contains a list of the nodes that have been
79  contracted into this node to make a
80  "super node" */
81  int dfnumber;
82  int low;
83  char is_art_point;
84  char deleted;
85  /*__BEGIN_EXPERIMENTAL_SECTION__*/
86  float r;
87  /*___END_EXPERIMENTAL_SECTION___*/
88 }vertex;
89 
90 typedef struct NETWORK{
91  int vertnum; /* the number of vertices in the graph */
92  char is_integral; /* indicates whether the graph is integral or
93  not */
94  int edgenum; /* the number of edges in the graph */
95  float mincut; /* the value of the current mincut */
96  struct ELIST *adjlist; /* the array containing the adajacency lists for
97  each node */
98  struct EDGE *edges; /* the list of edges in the graph */
99  struct VERTEX *verts; /* the list of vertices */
100  int *compnodes; /* number of nodes in each component */
101  double *new_demand; /* the amounts of demand for each node that gets
102  added to it when the network is contracted */
103  /*__BEGIN_EXPERIMENTAL_SECTION__*/
104  struct VERTEX **tnodes; /* a binary tree of the exiisting vertices used by
105  the min_cut routine */
106  struct VERTEX **enodes; /* a list of the nodes that still exist */
107  /*___END_EXPERIMENTAL_SECTION___*/
108 }network;
109 
110 network *createnet PROTO((int *xind, double *xval, int edgenum, double etol,
111  int *edges, int *demands, int vertnum));
112 /*__BEGIN_EXPERIMENTAL_SECTION__*/
113 network *createnet2 PROTO((int *xind, double *xval, int edgenum, double etol,
114  int *edges, int *demands, int vertnum,
115  char *status));
116 /*___END_EXPERIMENTAL_SECTION___*/
117 int connected PROTO((network *n, int *compnodes, int *compdemands,
118  int *compmembers, double *compcuts, double *compdensity));
119 void free_net PROTO((network *n));
120 
121 #endif
int other_end
Definition: network.h:58
#define PROTO(x)
Definition: sym_proto.h:27
char can_be_doubled
Definition: network.h:46
struct ELIST * next_edge
Definition: network.h:56
int enodenum
Definition: network.h:63
struct VERTEX vertex
struct ELIST * last
Definition: network.h:66
struct EDGE * other_data
Definition: network.h:48
Definition: network.h:62
int demand
Definition: network.h:75
struct EDGE * data
Definition: network.h:57
char scanned
Definition: network.h:44
struct EDGE edge
struct EDGE * edges
Definition: network.h:97
Definition: network.h:55
double * new_demand
Definition: network.h:100
char deleted
Definition: network.h:79
struct EDGE ** edges
Definition: network.h:63
struct NETWORK network
char is_integral
Definition: network.h:91
struct VERTEX ** tnodes
Definition: network.h:104
struct VERTEX * other
Definition: network.h:59
char is_art_point
Definition: network.h:78
Definition: network.h:35
int edgenum
Definition: network.h:93
int degree
Definition: network.h:71
struct ELIST * first
Definition: network.h:65
int orig_node_list_size
Definition: network.h:72
int comp
Definition: network.h:67
int v0
Definition: network.h:36
int * compnodes
Definition: network.h:99
char tree_edge
Definition: network.h:45
int * orig_node_list
Definition: network.h:73
struct ELIST elist
int cost
Definition: network.h:38
double weight
Definition: network.h:39
float r
Definition: network.h:86
struct VERTEX ** enodes
Definition: network.h:106
float q
Definition: network.h:44
int orignodenum
Definition: network.h:64
int edgenum
Definition: network.h:62
struct ELIST * adjlist
Definition: network.h:95
int row
Definition: network.h:45
int v1
Definition: network.h:37
char superlink
Definition: network.h:61
float mincut
Definition: network.h:94
char scanned
Definition: network.h:69
int low
Definition: network.h:77
int dfnumber
Definition: network.h:76
char deleted
Definition: network.h:46
struct VERTEX * verts
Definition: network.h:98
int vertnum
Definition: network.h:90