?? clusterdiscount.c
字號:
/*3:*/#line 82 "./clusterdiscount.w"const char*prog_name= "clusterdiscount";const char*clusterdiscount_rcs_id= "$Id: clusterdiscount.w,v 1.4 1998/12/05 22:38:10 neto Exp neto $";#include <config.h>#include "lkconfig.h"#include <stddef.h>#include <stdio.h>#include <stdlib.h>#include "error.h"#include "length.h"#include "read.h"#include "decluster.h"#include "kdtree.h"#include "dsort.h"static double dsj_random(const int i,const int j);static length_t noisy_cost(int u,int v);int noround= 0;int verbose= 0;long seed= -1998;void(*sort)(void*base,size_t nmemb,size_t size,int(*compar)(const void*,const void*))= dsort;/*5:*/#line 169 "./clusterdiscount.w"#if SIZEOF_INT==4typedef int int32;#elif SIZEOF_SHORT==4typedef short int int32;#elif SIZEOF_LONG==4typedef long int32;#else#error "I need a 32 bit integer for consistent results with DSJ_RANDOM"#endif/*:5*/#line 109 "./clusterdiscount.w"/*6:*/#line 181 "./clusterdiscount.w"static double dsj_random_factor= 1.0/2147483648.0;static int32 dsj_random_param= 99163;/*:6*/#line 110 "./clusterdiscount.w"/*4:*/#line 139 "./clusterdiscount.w"static doubledsj_random(const int ii,const int jj){const int32 i= ii,j= jj;const int32 salt1= 0x12345672*(i+1)+1;const int32 salt2= 0x12345672*(j+1)+1;int32 x,y,z;x= salt1&salt2;y= salt1|salt2;z= dsj_random_param;x*= z;y*= x;z*= y;z^= dsj_random_param;x*= z;y*= x;z*= y;x= ((salt1+salt2)^z)&0x7fffffff;return(double)(x*dsj_random_factor);}/*:4*//*7:*/#line 187 "./clusterdiscount.w"static length_tnoisy_cost(int u,int v){return cost(u,v)-decluster_d(u,v)*dsj_random(u,v);}/*:7*/#line 111 "./clusterdiscount.w"int main(int argc,char**argv){tsp_instance_t*tsp;decluster_tree_t*mst;if(argc>=2){seed= atoi(argv[1]);}tsp= read_tsp_file(stdin,NULL,0);if(E2_supports(tsp)){E2_create(tsp);}mst= decluster_setup(tsp->n);decluster_mst(tsp,mst);decluster_preprocess(mst);/*8:*/#line 197 "./clusterdiscount.w"dsj_random_factor= 1.0/2147483648.0;dsj_random_param= 1+104*seed;{FILE*out= stdout;int row,col,n= tsp->n;fprintf(out,"NAME: cd.%ld.%s\n",seed,tsp->name);fprintf(out,"TYPE: TSP\n");fprintf(out,"COMMENT: %s | clusterdiscount %ld\n",(tsp->comment?tsp->comment:""),seed);fprintf(out,"DIMENSION: %d\n",tsp->n);fprintf(out,"EDGE_WEIGHT_TYPE: EXPLICIT\n");fprintf(out,"EDGE_WEIGHT_FORMAT: UPPER_ROW\n");fprintf(out,"EDGE_WEIGHT_SECTION:\n");for(row= 0;row<n;row++){for(col= row+1;col<n;col++){fprintf(out," %ld",(long)noisy_cost(row,col));}fprintf(out,"\n");}fprintf(out,"EOF\n");}/*:8*/#line 126 "./clusterdiscount.w"return 0;}/*:3*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -