/home/coin/SVN-release/CoinAll-1.1.0/SYMPHONY/Applications/CNRP/include/network.h

Go to the documentation of this file.
00001 /*===========================================================================*/
00002 /*                                                                           */
00003 /* This file is part of a demonstration application for use with the         */
00004 /* SYMPHONY Branch, Cut, and Price Library. This application is a solver for */
00005 /* Capacitated Network Routing Problems.                                     */
00006 /*                                                                           */
00007 /* (c) Copyright 2000-2008 Ted Ralphs. All Rights Reserved.                  */
00008 /*                                                                           */
00009 /* This application was developed by Ted Ralphs (tkralphs@lehigh.edu)        */
00010 /*                                                                           */
00011 /* This software is licensed under the Common Public License. Please see     */
00012 /* accompanying file for terms.                                              */
00013 /*                                                                           */
00014 /*===========================================================================*/
00015 
00016 #ifndef _NETWORK
00017 #define _NETWORK
00018 
00019 /* SYMPHONY include files */
00020 #include "sym_proto.h"
00021 
00022 /* CNRP include files */
00023 #include "cnrp_const.h"
00024 
00025 #define NOT_INTEGRAL -1
00026 #define OTHER_END(cur_edge, v) \
00027         (cur_edge->data->v0 == v) ? cur_edge->data->v1 : cur_edge->data->v0
00028 
00029 /*-----------------------------------------------------------------------*\
00030 | These are data tructures used in constructing the solution graph used   |
00031 | by the cut generator to locate cuts. The graph is stored using          |
00032 | adjacency lists                                                         |
00033 \*-----------------------------------------------------------------------*/
00034 
00035 typedef struct EDGE{
00036    int v0;      
00037    int v1;
00038    int cost;
00039    double weight;
00040 #ifdef DIRECTED_X_VARS
00041    double weight1;
00042    double weight2;
00043 #endif
00044    char scanned;
00045    char tree_edge;
00046    char deleted;
00047    /*For minimum cut*/
00048    double q;
00049 #ifdef ADD_FLOW_VARS
00050    double flow1;
00051    double flow2;
00052 #endif
00053 }edge;
00054 
00055 typedef struct ELIST{
00056    struct ELIST  *next_edge; /* next edge in the edgelist */
00057    struct EDGE   *data;      /* the data of the edge */
00058    int            other_end; /* the other end of the edge */
00059    struct VERTEX *other;
00060 }elist;
00061 
00062 typedef struct VERTEX{
00063   int           enodenum;   /* the node number in the contracted graph */
00064   int           orignodenum;/* the node number in the original graph */
00065   struct ELIST *first; /* points to the first edge in the adjacency list */
00066   struct ELIST *last;  /* points to the last edge in the adjacency list */
00067   int           comp;  /* contains the component number if the graph is
00068                           disconnected */
00069   char          scanned;
00070   double        demand; /* contains the demand for this node */
00071   int           degree; /* contains the degree of the node in the graph */
00072   int           orig_node_list_size;
00073   int          *orig_node_list; /* contains a list of the nodes that have been
00074                                    contracted into this node to make a
00075                                    "super node" */
00076   int           dfnumber;
00077   int           low;
00078   char          is_art_point;
00079   char          deleted;
00080   double        weight; /*For contracting the graph*/ 
00081   /*For minimum cut*/
00082   char          orig_node_list2_size;
00083   char         *orig_node_list2; /* contains a list of the nodes that have been
00084                                    contracted into this node to make a
00085                                    "super node" */
00086   double        r; 
00087 }vertex;
00088 
00089 typedef struct NETWORK{
00090   int             vertnum; /* the number of vertices in the graph */
00091   char            is_integral; /* indicates whether the graph is integral or
00092                                   not */
00093   int             edgenum; /* the number of edges in the graph */
00094   float           mincut;  /* the value of the current mincut */
00095   struct ELIST   *adjlist; /* the array containing the adajacency lists for
00096                               each node */
00097   struct EDGE    *edges; /* the list of edges in the graph */
00098   struct VERTEX  *verts; /* the list of vertices */
00099   int            *compnodes;  /* number of nodes in each component */
00100   double         *new_demand; /* the amounts of demand for each node that gets
00101                                  added to it when the network is contracted */
00102 
00103   /*For minimum cut algorithm*/
00104   struct VERTEX **tnodes; /*a binary tree of the existing vertices used by the
00105                             min_cut routine*/
00106   struct VERTEX **enodes; /*a list of the nodes that still exist*/
00107 }network;
00108 
00109 network *create_net PROTO((int *xind, double *xval, int edgenum, double etol,
00110                            int *edges, double *demands, int vertnum));
00111 network *create_flow_net PROTO((int *xind, double *xval, int edgenum,
00112                                 double etol, int *edges, double *demands,
00113                                 int vertnum));
00114 int connected PROTO((network *n, int *compnodes, double *compdemands,
00115                    int *compmembers, double *compcuts, double *compdensity));
00116 int flow_connected PROTO((network *n, int *compnodes, double *compdemands,
00117                           int *compmembers, double *compcuts,
00118                           double *compdensity, double etol));
00119 void free_net PROTO((network *n));
00120 
00121 #endif

Generated on Sun Nov 14 14:06:41 2010 for Coin-All by  doxygen 1.4.7