This is simple.c in view mode; [Download] [Up]
#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;
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.