home *** CD-ROM | disk | FTP | other *** search
- #import "TwoDView.h" /* the main class */
- #import "TwoDTSP.h" /* this category */
-
- #define FROM 0
- #define TO 1
- float simpleTSP(int n,float *data,float *distances,int *edges);
-
- /* everything is allocated before it comes in */
- float simpleTSP(int n,float *data,float *distances,int *edges)
- {
- int x,opt;
- for(x=0;x<n-1;x++) {/* calculate the distances*/
- opt += distances[x][x+1];
- edges[x][FROM] = x; /* connect the first one to the second one ...*/
- edges[x][TO] = x+1
- }
- return opt;
- }
-