Dip  0.92.4
vrp_common_types.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 _VRP_COMMON_TYPES_H
17 #define _VRP_COMMON_TYPES_H
18 
19 /*---------------------------------------------------------------------*\
20 | This _node data structure holds information about a customer node in |
21 | a tour. The next field contains the index of the node that is next |
22 | on the current route or if the current node is the last on eon its |
23 | route, it contains the index of the first node on the next route. |
24 | The route number field contains the number of the route that the |
25 | node is on. This information is maintained to make reconstruction of |
26 | the route and calculation of the route cost possible |
27 \*---------------------------------------------------------------------*/
28 
29 typedef struct _NODE{
30  int next;
31  int route;
32 }_node;
33 
34 /*--------------------------------------------------------------------*\
35 | This data structure contains information about a tour's route |
36 | structure. Specifically, first and last are the first and last nodes |
37 | on a particular route, numcust is the number of customers on the |
38 | route and cost is the cost of that route. The routes are always |
39 | numbered starting at 1 for convenience in certain calculations so |
40 | route_info[0] always contains 0 in all fields. |
41 \*--------------------------------------------------------------------*/
42 
43 typedef struct ROUTE_DATA{
44  int first;
45  int last;
46  int numcust;
47  int weight;
48  int cost;
49 }route_data;
50 
51 /*--------------------------------------------------------------------*\
52 | The best_tours data structure is for storing tours for later use. The|
53 | cost field contains the total cost of the tour. The numroutes field |
54 | contains the number of trucks used in the tour and the tour field is |
55 | a pointer to an array which specifies the order of each of the |
56 | routes as explained above. The field route_info contains |
57 | information about the tour's routes as explained above |
58 \*--------------------------------------------------------------------*/
59 typedef struct BEST_TOURS{
60  int algorithm;
61  double solve_time;
62  int cost;
63  int numroutes;
65  _node *tour;
66 }best_tours;
67 
68 /*--------------------------------------------------------------------*\
69 | Stores the method by which distances should be calculated |
70 \*--------------------------------------------------------------------*/
71 
72 typedef struct DISTANCES{
73  int wtype;
74  int *cost;
75  double *coordx;
76  double *coordy;
77  double *coordz;
78 }distances;
79 
80 /*--------------------------------------------------------------------*\
81 | This structure contains information about a particular edge |
82 \*--------------------------------------------------------------------*/
83 
84 typedef struct EDGE_DATA{
85  int v0;
86  int v1;
87  int cost;
88 }edge_data;
89 
90 typedef struct DBL_EDGE_DATA{
91  int v0;
92  int v1;
93  double cost;
95 
96 #endif
double * coordy
double * coordx
struct DISTANCES distances
struct ROUTE_DATA route_data
route_data * route_info
struct DBL_EDGE_DATA dbl_edge_data
struct BEST_TOURS best_tours
struct EDGE_DATA edge_data
struct _NODE _node
double * coordz