PageRenderTime 32ms CodeModel.GetById 19ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/farmR/src/glptsp.h

https://code.google.com/p/javawfm/
C++ Header | 103 lines | 44 code | 10 blank | 49 comment | 0 complexity | 19655f375f0675d44617d0303d035dd3 MD5 | raw file
  1/* glptsp.h (TSP format) */
  2
  3/***********************************************************************
  4*  This code is part of GLPK (GNU Linear Programming Kit).
  5*
  6*  Copyright (C) 2000,01,02,03,04,05,06,07,08,2009 Andrew Makhorin,
  7*  Department for Applied Informatics, Moscow Aviation Institute,
  8*  Moscow, Russia. All rights reserved. E-mail: <mao@mai2.rcnet.ru>.
  9*
 10*  GLPK is free software: you can redistribute it and/or modify it
 11*  under the terms of the GNU General Public License as published by
 12*  the Free Software Foundation, either version 3 of the License, or
 13*  (at your option) any later version.
 14*
 15*  GLPK is distributed in the hope that it will be useful, but WITHOUT
 16*  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 17*  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
 18*  License for more details.
 19*
 20*  You should have received a copy of the GNU General Public License
 21*  along with GLPK. If not, see <http://www.gnu.org/licenses/>.
 22***********************************************************************/
 23
 24#ifndef _GLPTSP_H
 25#define _GLPTSP_H
 26
 27typedef struct TSP TSP;
 28
 29struct TSP
 30{     /* TSP (or related problem) instance in the format described in
 31         the report [G.Reinelt, TSPLIB 95] */
 32      /*--------------------------------------------------------------*/
 33      /* the specification part */
 34      char *name;
 35      /* identifies the data file */
 36      int type;
 37      /* specifies the type of data: */
 38#define TSP_UNDEF             0  /* undefined */
 39#define TSP_TSP               1  /* symmetric TSP */
 40#define TSP_ATSP              2  /* asymmetric TSP */
 41#define TSP_TOUR              3  /* collection of tours */
 42      char *comment;
 43      /* additional comments (usually the name of the contributor or
 44         creator of the problem instance is given here) */
 45      int dimension;
 46      /* for a TSP or ATSP, the dimension is the number of its nodes
 47         for a TOUR it is the dimension of the corresponding problem */
 48      int edge_weight_type;
 49      /* specifies how the edge weights (or distances) are given: */
 50#define TSP_UNDEF             0  /* undefined */
 51#define TSP_EXPLICIT          1  /* listed explicitly */
 52#define TSP_EUC_2D            2  /* Eucl. distances in 2-D */
 53#define TSP_CEIL_2D           3  /* Eucl. distances in 2-D rounded up */
 54#define TSP_GEO               4  /* geographical distances */
 55#define TSP_ATT               5  /* special distance function */
 56      int edge_weight_format;
 57      /* describes the format of the edge weights if they are given
 58         explicitly: */
 59#define TSP_UNDEF             0  /* undefined */
 60#define TSP_FUNCTION          1  /* given by a function */
 61#define TSP_FULL_MATRIX       2  /* given by a full matrix */
 62#define TSP_UPPER_ROW         3  /* upper triangulat matrix (row-wise
 63                                    without diagonal entries) */
 64#define TSP_LOWER_DIAG_ROW    4  /* lower triangular matrix (row-wise
 65                                    including diagonal entries) */
 66      int display_data_type;
 67      /* specifies how a graphical display of the nodes can be
 68         obtained: */
 69#define TSP_UNDEF             0  /* undefined */
 70#define TSP_COORD_DISPLAY     1  /* display is generated from the node
 71                                    coordinates */
 72#define TSP_TWOD_DISPLAY      2  /* explicit coordinates in 2-D are
 73                                    given */
 74      /*--------------------------------------------------------------*/
 75      /* data part */
 76      /* NODE_COORD_SECTION: */
 77      double *node_x_coord; /* double node_x_coord[1+dimension]; */
 78      double *node_y_coord; /* double node_y_coord[1+dimension]; */
 79      /* DISPLAY_DATA_SECTION: */
 80      double *dply_x_coord; /* double dply_x_coord[1+dimension]; */
 81      double *dply_y_coord; /* double dply_y_coord[1+dimension]; */
 82      /* TOUR_SECTION: */
 83      int *tour; /* int tour[1+dimension]; */
 84      /* EDGE_WEIGHT_SECTION: */
 85      int *edge_weight; /* int edge_weight[1+dimension*dimension]; */
 86};
 87
 88#define tsp_read_data         _glp_tsp_read_data
 89#define tsp_free_data         _glp_tsp_free_data
 90#define tsp_distance          _glp_tsp_distance
 91
 92TSP *tsp_read_data(char *fname);
 93/* read TSP instance data */
 94
 95void tsp_free_data(TSP *tsp);
 96/* free TSP instance data */
 97
 98int tsp_distance(TSP *tsp, int i, int j);
 99/* compute distance between two nodes */
100
101#endif
102
103/* eof */