VRPH  1.0
inc/VRPUtils.h
Go to the documentation of this file.
00001 
00002 //                                                        //
00003 // This file is part of the VRPH software package for     //
00004 // generating solutions to vehicle routing problems.      //
00005 // VRPH was developed by Chris Groer (cgroer@gmail.com).  //
00006 //                                                        //
00007 // (c) Copyright 2010 Chris Groer.                        //
00008 // All Rights Reserved.  VRPH is licensed under the       //
00009 // Common Public License.  See LICENSE file for details.  //
00010 //                                                        //
00012 
00013 #ifndef _VRP_UTIL_H
00014 #define _VRP_UTIL_H
00015 
00016 
00017 #define MAX_FILES                               20000
00018 #define MAX_FILENAME_LENGTH             40
00019 
00020 // Misc
00021 #define NUM_ELITE_SOLUTIONS             200
00022 #define MAX_NUM_COLS                    10000
00023 #define NUM_ENTRIES                             8
00024 #define MAX_VRPH_TABU_LIST_SIZE 50
00025 
00026 #define HASH_TABLE_SIZE                 (1<<18)
00027 #define SALT_1                                  0
00028 #define SALT_2                                  11
00029 
00030 struct htable_entry
00031 {
00039 
00040         int num_vals;
00041         int hash_val_2[NUM_ENTRIES];
00042         int tot;
00043         double length[NUM_ENTRIES];
00044 
00045 };
00046 
00047 struct int_int
00048 {
00049         int i;
00050         int j;
00051 };
00052 struct double_int
00053 {
00054         double d;
00055         int k;
00056 };
00057 
00058 class VRPSavingsElement
00059 {
00060 public:
00061         // Useful to make some of the bookkeeping simpler when
00062         // calculating the savings.
00063         double savings;
00064         int position;
00065         int i;
00066         int j;
00067 };
00068 
00069 
00070 class VRPNeighborElement
00071 {
00072 public:
00073         double val;
00074         int position;
00075 };
00076 
00077 
00078 class VRPViolation
00079 {
00080 public:
00081         double length_violation;
00082         int    capacity_violation;
00083 };
00084 
00085 
00086 
00087 class VRPSeedElement 
00088 {
00089         double val;
00090         int position;
00091         int demand;
00092 };
00093 
00094 class VRPNeighborhood
00095 {
00096 public:
00097         int move_type;
00098         int node_1, node_2;
00099         class VRPMove *Moves;
00100         int size;
00101 
00102         VRPNeighborhood(int n);
00103 };
00104 
00105 struct VRPSegment
00106 {
00111 
00112         int segment_start;
00113         int segment_end;
00114 
00115         int num_custs;
00116         int load;
00117         double len;
00118 
00119 };
00120 
00121 
00122 
00123 double VRPDistance(int type, double x1, double y1, double x2, double y2);
00124 int VRPDistanceCompare(const void *a, const void *b);
00125 int VRPIntCompare(const void *a, const void *b);
00126 int VRPSavingsCompare (const void *a, const void *b);
00127 int VRPNeighborCompare (const void *a, const void *b);
00128 int VRPAlphaCompare(const void *a, const void *b);
00129 int double_int_compare (const void *a, const void *b);
00130 int int_int_compare (const void *a, const void *b);
00131 int VRPSolutionCompare(const void *a, const void *b);
00132 int VRPCheckTSPLIBString(char *s);
00133 int VRPGetDimension(char *filename);
00134 int VRPGetNumDays(char *filename);
00135 
00136 
00137 #endif
00138 
00139 
00140 
00141 
00142