Diploma Thesis Percolation Simulation C++ Sourcecode Documentation |
00001 // optimizealgo.h 00002 // test the speed of the algo for different "cuts" 00003 // (ratio of cellcount to divide&combine) 00004 // 00005 // (c) 2000 Andreas Krueger 00006 // Version 1.0 00007 // last change: 31.10.2000 00008 00009 namespace optimize{ 00010 using namespace statistics; 00011 using namespace datafiles; 00012 using counters::naive_arraycount_and_analyze; 00013 using counters::maximal_dividings_in_one_coordinate; 00014 using counters::divide_by_c_cuts_count_and_analyze; 00015 using analyze::sameresult; 00016 using analyze::show_twohisto; 00017 using ff::fillingfactor_functions; 00018 using ff::give_one_stepfunction; 00019 00020 void run_different_cuts(int dimension) { 00021 00022 NUMBER N; 00023 cout <<"Please type in NUMBER of spheres: "; 00024 cin >> N; 00025 00026 sphere *spheres = new sphere[N+1]; 00027 set_dim(spheres,0,N,dimension); 00028 00029 throw_spheres(spheres, 1, N); // randomly throw spheres from 1 to N in array scatter 00030 00031 double rr=R_critical(N,GRIDSIZE, dimension); 00032 if (rr!=-1) { 00033 cout << "The theoretically critical radius in "; 00034 cout <<dimension<<"dim is "<<rr; 00035 } 00036 else { 00037 rr=R_critical_guessed(N,GRIDSIZE,dimension); 00038 cout << "The critical radius in "; 00039 cout <<dimension<<"dim is approximately "<<rr; 00040 } 00041 cout <<"\nPlease type in the radius of one sphere: "; 00042 REAL R; cin >> R; 00043 cout <<"**************************************************"<<endl; 00044 00045 set_radius(spheres,1,N,R); 00046 00047 COUNTER cut_max=dimension*maximal_dividings_in_one_coordinate(GRIDSIZE,R); 00048 00049 cout <<"Theoretically, the spheres of this radius should not be placed in boxes"; 00050 cout <<"\nthat are made by more than "<<cut_max<<" cuts."<<endl; 00051 cout <<"But the algo doesn't seem to care about that :-)"<<endl; 00052 00053 NUMBER *histo1=new NUMBER[(N+1)]; 00054 NUMBER biggestcl1; REAL averagecl1; 00055 cout<<"\narraycount (old algo for reference; ~same as cuts=0).."<<flush; 00056 clock_t time1=clock(); 00057 set_clusternumber(spheres,1,N,0); 00058 naive_arraycount_and_analyze(spheres, 1, N, histo1, biggestcl1,averagecl1); 00059 time1 = clock()-time1; 00060 cout <<". took "<<ms(time1)<< "ms."<<endl; 00061 00062 NUMLIST all; 00063 increasing_integers (all, N); // fill the list "all" with the numbers of all spheres 00064 NUMBER *histo2=new NUMBER[(N+1)]; 00065 NUMBER biggestcl2=0; 00066 REAL averagecl2=0; 00067 00068 COUNTER cuts=0; 00069 clock_t time2=0; 00070 00071 while (time2<time1) { 00072 cuts++; 00073 time2=clock(); 00074 cout <<"divide_"<<cuts<<"times count ("<<pow(2,cuts)<<" boxes)..."<<flush; 00075 set_clusternumber(spheres,1,N,0); 00076 divide_by_c_cuts_count_and_analyze(spheres, all, cuts,histo2, biggestcl2, averagecl2); 00077 time2=clock()-time2; 00078 00079 if (sameresult(histo1,histo2, 1, biggestcl1)) 00080 cout <<" !correct result!"; 00081 else { 00082 cout <<"\nLOOSER - the divide_by_c_cuts gives differing results !!!"; 00083 exit (1); 00084 } 00085 cout << " time= "<<ms(time2)<<"ms."<<endl; 00086 } 00087 00088 delete[] spheres, histo1, histo2; 00089 cout <<"\n\n biggestcluster: \t"<<biggestcl1<<"\t"<<biggestcl2; 00090 cout <<"\n averagecluster: \t"<<averagecl1<<"\t"<<averagecl2; 00091 00092 cout <<"\n\nnormalcount: \t"<<ms(time1)<<"ms"; 00093 cout <<"\ndivide"<<cuts<<"times count: \t"<<ms(time2)<<"ms"<<endl; 00094 00095 cout <<"if you want to see the histograms, "; 00096 waitanykey(); 00097 show_twohisto(histo1, histo2, biggestcl1); 00098 } 00099 00100 00101 00102 00103 void double_N_and_run_specified_cuts(int dimension, char* filename) { 00104 00105 write_intro(filename,1,1, 1, dimension); 00106 00107 REAL NN; 00108 cout <<"Please type in the starting NUMBER of spheres: "; 00109 cin >> NN; 00110 00111 COUNTER lower_c, upper_c; 00112 cout <<"Please type in the range for the cuts ( e.g. [1...20] )"<<endl; 00113 cout <<"cuts=0 means: old algo"<<endl; 00114 /* 00115 cout <<"N.B.: The old algo (cuts=0) is computed for reference, anyway"<<endl; 00116 */ 00117 cout <<"starting number of cuts :"; 00118 cin >> lower_c; 00119 cout <<"ending number of cuts :"; 00120 cin >> upper_c; 00121 00122 char compname[80]; 00123 cout <<"Please type in a name for the calculating computer: "; 00124 cin >> compname; 00125 00126 cout << "The results will be written into: "; 00127 cout << filename<<endl; 00128 00129 cout <<"\nNow please leave your computer alone...thanks\n"<<endl; 00130 00131 write_cuts_intro(filename, 00132 compname, 00133 GRIDSIZE, 1, dimension); 00134 00135 00136 NUMBER N; 00137 00138 for (;;) { 00139 N=(int)NN; 00140 cout <<"******** N="<<N<< "********"<<endl; 00141 sphere *spheres = new sphere[N+1]; 00142 set_dim(spheres,0,N,dimension); 00143 00144 throw_spheres(spheres, 1, N); // randomly throw spheres from 1 to N in array scatter 00145 00146 double rr=R_critical(N,GRIDSIZE, dimension); 00147 if (rr!=-1) { 00148 cout << "The theoretically critical radius in "; 00149 cout <<dimension<<"dim is "<<rr; 00150 } 00151 else { 00152 rr=R_critical_guessed(N,GRIDSIZE,dimension); 00153 cout << "The critical radius in "; 00154 cout <<dimension<<"dim is approximately "<<rr; 00155 } 00156 00157 REAL R=rr; 00158 set_radius(spheres,1,N,R); 00159 COUNTER cut_max=dimension*maximal_dividings_in_one_coordinate(GRIDSIZE,R); 00160 cout <<"\nTheoretically, the spheres of this radius should not be placed in boxes"; 00161 cout <<"\nthat are made by more than "<<cut_max<<" cuts."<<endl; 00162 cout <<"But the algo doesn't seem to care about that :-)"<<endl; 00163 00164 NUMBER *histo1=new NUMBER[(N+1)]; 00165 00166 00167 /* 00168 NUMBER biggestcl1; 00169 REAL averagecl1; 00170 cout<<"\narraycount (old algo for reference; ~same as cuts=0).."<<flush; 00171 clock_t time1=clock(); 00172 set_clusternumber(spheres,1,N,0); 00173 NUMBER bigclno1=arraycount_and_analyze(spheres, 1, N, histo1, biggestcl1,averagecl1); 00174 time1 = clock()-time1; 00175 cout <<". took "<<ms(time1)<< "ms."<<endl; 00176 00177 write_one_cut(filename, N, rr, cut_max,0, time1); 00178 */ 00179 00180 NUMLIST all; 00181 increasing_integers (all, N); // fill the list "all" with the numbers of all spheres 00182 NUMBER *histo2=new NUMBER[(N+1)]; 00183 NUMBER biggestcl2; 00184 REAL averagecl2; 00185 00186 COUNTER cuts=lower_c; 00187 clock_t time2=0; 00188 00189 while (cuts<=upper_c) { 00190 time2=clock(); 00191 cout <<"divide_"<<cuts<<"times count ("<<pow(2,cuts)<<" boxes)..."<<flush; 00192 set_clusternumber(spheres,1,N,0); 00193 divide_by_c_cuts_count_and_analyze(spheres, all, cuts,histo2, biggestcl2, averagecl2); 00194 time2=clock()-time2; 00195 00196 /* 00197 if (sameresult(histo1,histo2, 1, biggestcl1)) 00198 cout <<" !correct result!"; 00199 else { 00200 cout <<"\nLOOSER - the divide_by_c_cuts gives differing results !!!"; 00201 exit (1); 00202 } 00203 */ 00204 cout << " time= "<<ms(time2)<<"ms."<<endl; 00205 write_one_cut(filename, N, rr, cut_max,cuts, time2); 00206 00207 cuts++; 00208 } 00209 00210 delete[] spheres, histo1, histo2; 00211 write_one_cut(filename, N, 0, 0,0,0); 00212 00213 NN*=2; 00214 } 00215 } 00216 00217 00218 00219 00220 00221 00222 00223 00224 void double_N_and_run_all_faster_cuts(int dimension, char* filename) { 00225 00226 write_intro(filename,1,1, 1, dimension); 00227 00228 REAL NN; 00229 cout <<"Please type in the starting NUMBER of spheres: "; 00230 cin >> NN; 00231 00232 char compname[80]; 00233 cout <<"Please type in a name for the calculating computer: "; 00234 cin >> compname; 00235 00236 cout << "The results will be written into: "; 00237 cout << filename<<endl; 00238 00239 cout <<"\nNow please leave your computer alone...thanks\n"<<endl; 00240 00241 write_cuts_intro(filename, 00242 compname, 00243 GRIDSIZE, 1, dimension); 00244 00245 NUMBER N; 00246 for(;;) { 00247 N=(int)NN; 00248 cout <<"******** N="<<N<< "********"<<endl; 00249 sphere *spheres = new sphere[N+1]; 00250 set_dim(spheres,0,N,dimension); 00251 throw_spheres(spheres, 1, N); // randomly throw spheres from 1 to N in array scatter 00252 double rr=R_critical(N,GRIDSIZE, dimension); 00253 if (rr!=-1) { 00254 cout << "The theoretically critical radius in "; 00255 cout <<dimension<<"dim is "<<rr; 00256 } 00257 else { 00258 rr=R_critical_guessed(N,GRIDSIZE,dimension); 00259 cout << "The critical radius in "; 00260 cout <<dimension<<"dim is approximately "<<rr; 00261 } 00262 REAL R=rr; 00263 set_radius(spheres,1,N,R); 00264 COUNTER cut_max=dimension*maximal_dividings_in_one_coordinate(GRIDSIZE,R); 00265 cout <<"\nTheoretically, the spheres of this radius should not be placed in boxes"; 00266 cout <<"\nthat are made by more than "<<cut_max<<" cuts."<<endl; 00267 cout <<"But the algo doesn't seem to care about that :-)"<<endl; 00268 00269 NUMBER *histo1=new NUMBER[(N+1)]; 00270 NUMBER biggestcl1; REAL averagecl1; 00271 cout<<"\narraycount (old algo for reference; ~same as cuts=0).."<<flush; 00272 clock_t time1=clock(); 00273 set_clusternumber(spheres,1,N,0); 00274 naive_arraycount_and_analyze(spheres, 1, N, histo1, biggestcl1,averagecl1); 00275 time1 = clock()-time1; 00276 cout <<". took "<<ms(time1)<< "ms."<<endl; 00277 00278 write_one_cut(filename, N, rr, cut_max,0, time1); 00279 00280 NUMLIST all; 00281 increasing_integers (all, N); // fill the list "all" with the numbers of all spheres 00282 NUMBER *histo2=new NUMBER[(N+1)]; 00283 NUMBER biggestcl2; 00284 REAL averagecl2; 00285 00286 COUNTER cuts=1; 00287 clock_t time2=0; 00288 00289 while (time2<time1) { 00290 00291 time2=clock(); 00292 cout <<"divide_"<<cuts<<"times count ("<<pow(2,cuts)<<" boxes)..."<<flush; 00293 set_clusternumber(spheres,1,N,0); 00294 divide_by_c_cuts_count_and_analyze(spheres, all, cuts,histo2, biggestcl2, averagecl2); 00295 time2=clock()-time2; 00296 00297 if (sameresult(histo1,histo2, 1, biggestcl1)) 00298 cout <<" !correct result!"; 00299 else { 00300 cout <<"\nLOOSER - the divide_by_c_cuts gives differing results !!!"; 00301 exit (1); 00302 } 00303 cout << " time= "<<ms(time2)<<"ms."<<endl; 00304 write_one_cut(filename, N, rr, cut_max,cuts, time2); 00305 00306 cuts++; 00307 } 00308 00309 delete[] spheres, histo1, histo2; 00310 write_one_cut(filename, N, 0, 0,0,0); 00311 00312 NN*=2; 00313 } ; 00314 } 00315 00316 00317 void test_average_time_for_specified_cuts(const char* filename, 00318 int criterion, 00319 REAL ratio, 00320 int dimension, 00321 COUNTER Nsteps, 00322 NUMBER *NN, 00323 COUNTER *loops, 00324 COUNTER cuts[][2]) { 00325 00326 NUMBER N; 00327 COUNTER lower_c, upper_c; 00328 REAL rc; 00329 00330 NUMLIST all; 00331 NUMBER *histo; 00332 NUMBER biggestcl; 00333 REAL averagecl; 00334 00335 clock_t eachtime; 00336 REAL time_mean, time_sdev; 00337 std::list<clock_t> time_results; 00338 std::list<clock_t>::iterator onetime; 00339 00340 fillingfactor_functions ff_fn; 00341 ff_fn=give_one_stepfunction(criterion); 00342 00343 00344 for (COUNTER Nstep=0;Nstep<Nsteps;Nstep++){ 00345 N=NN[Nstep]; 00346 sphere *spheres = new sphere[N+1]; 00347 set_dim(spheres,0,N,dimension); 00348 increasing_integers (all, N); // fill the list "all" with the numbers of all spheres 00349 histo=new NUMBER[(N+1)]; // make a new histogram table 00350 00351 cout <<"\n N="<<N<< "; "<<flush; 00352 00353 00354 REAL ff = ff_fn.theory(N, dimension, ratio); 00355 rc=give_radius (ff, N, GRIDSIZE, dimension); 00356 00357 00358 if (rc!=-1) cout << "rc(dim="<<dimension<<", N="<<N<<", area="<<pow(GRIDSIZE, dimension)<<")="<<rc; 00359 else { 00360 rc=R_critical_guessed(N,GRIDSIZE,dimension); 00361 cout << "chosen guessed critical radius as rc(dim="<<dimension<<") :"<<rc; 00362 } 00363 00364 lower_c=cuts[Nstep][0]; 00365 upper_c=cuts[Nstep][1]; 00366 for (COUNTER cuts=lower_c;cuts<=upper_c;cuts++){ 00367 00368 cout <<"\ncuts="<<cuts<<" (divide into "<<pow(2,cuts)<<" boxes)..."<<flush; 00369 cout <<"for "<<loops[Nstep]<< " averaging times:"<<endl; 00370 00371 time_results.clear(); 00372 for (COUNTER loop=0;loop<loops[Nstep];loop++){ 00373 throw_spheres(spheres, 1, N); // randomly throw spheres from 1 to N in array scatter 00374 set_radius(spheres,1,N,rc); 00375 set_clusternumber(spheres,1,N,0); 00376 eachtime=clock(); 00377 divide_by_c_cuts_count_and_analyze(spheres, all, cuts,histo, biggestcl, averagecl); 00378 eachtime=clock()-eachtime; 00379 time_results.push_back(eachtime); 00380 cout << ms(eachtime)<<"ms "<<flush; 00381 } 00382 00383 averaging<clock_t> (time_results, time_mean, time_sdev); 00384 00385 cout<<"\naverage time: "<<ms((clock_t)time_mean)<<"ms +/- "<<ms((clock_t)time_sdev)<<"ms" <<endl; 00386 write_one_averaged_cut(filename, N, rc, loops[Nstep], cuts, 00387 (clock_t)rounded(time_mean), (clock_t)rounded(time_sdev)); 00388 } 00389 00390 delete[] spheres, histo; 00391 all.clear(); 00392 00393 write_one_averaged_cut(filename, N, 0, 0,0,0,0); 00394 } 00395 } 00396 00397 00398 void cuts_test_average_time(int criterion, REAL ratio, string compname); 00399 00400 00401 void frontend_cuts_test_average_time(int criterion, REAL ratio) { 00402 string compname; 00403 cout <<" P.. P...Pl.. Please type in a name for the calculating computer: "; 00404 cin >> compname; 00405 00406 char filenameXX[]="c:\\results\\doublenumberXX.txt"; 00407 cout << "\n\nThe results will be written into Files like this: "; 00408 cout << filenameXX<<endl; 00409 cout <<"\nAfter <anykey>+<return> please leave your computer alone...thanks\n"<<endl; 00410 waitanykey(); 00411 00412 cuts_test_average_time(criterion, ratio, compname); 00413 } 00414 00415 string concat_filename(string path, string name, int dim, int maxdim){ 00416 char buffer[16]; 00417 00418 sprintf(buffer, "dim%d_(maxdim%d", dim, maxdim); 00419 00420 return path+name+string(buffer)+").txt"; 00421 } 00422 00423 void cuts_test_average_time(int criterion, REAL ratio, string compname) { 00424 00425 int dimension; 00426 string fname="cuts-range_"; 00427 00428 // These are optimized ranges for ffS !!! not for ffC 00429 00430 /* 00431 // 1dim 00432 dimension=1; 00433 const COUNTER Nsteps1=12; 00434 NUMBER scan_N1[Nsteps1]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00435 COUNTER loops1[Nsteps1]= {50 , 50 , 15, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00436 COUNTER cuts1[Nsteps1][2]={{0,8},{0,8},{2,8},{3,8},{4,9},{5,9},{6,11},{7,11},{7,12}, {9,13}, {10,13}, {10,14}}; 00437 COUNTER steps1=12; 00438 00439 string filename1=concat_filename(FILEHEAD2, fname, dimension, MAXDIM); 00440 cout << "\n\n1dim...The following results will be written into: "<<endl; 00441 cout << filename1<<endl; 00442 00443 write_averaged_cuts_intro(filename1.c_str(), compname, GRIDSIZE, dimension, criterion); 00444 test_average_time_for_specified_cuts(filename1.c_str(), criterion, ratio, dimension, steps1, scan_N1, loops1, cuts1); 00445 00446 00447 // 2dim 00448 dimension=2; 00449 const COUNTER Nsteps2=12; 00450 NUMBER scan_N2[Nsteps2]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00451 COUNTER loops2[Nsteps2]= {40 , 30 , 15, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00452 COUNTER cuts2[Nsteps2][2]={{0,7},{0,7},{1,8},{2,8},{3,8},{4,9},{5,9},{6,9},{7,10}, {7,10}, {7,11}, {7,11}}; 00453 00454 COUNTER steps2=12; 00455 00456 string filename2=concat_filename(FILEHEAD2, fname, dimension, MAXDIM); 00457 cout << "\n\n2dim...The following results will be written into: "<<endl; 00458 cout << filename2<<endl; 00459 00460 write_averaged_cuts_intro(filename2.c_str(), compname, GRIDSIZE, dimension, criterion); 00461 test_average_time_for_specified_cuts(filename2.c_str(), criterion, ratio, dimension, steps2, scan_N2, loops2, cuts2); 00462 00463 00464 // 3dim 00465 dimension=3; 00466 const COUNTER Nsteps3=12; 00467 NUMBER scan_N3[Nsteps3]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00468 COUNTER loops3[Nsteps3]= { 40 , 30 , 30, 15, 10, 10, 7, 5, 4, 4, 3, 3}; 00469 COUNTER cuts3[Nsteps3][2]={{0,6},{0,6},{0,6},{0,7}, {0,7}, {0,7},{1,7}, {2,8}, {5,9},{5,9},{5,9}, {6,10}}; 00470 00471 COUNTER steps3=11; 00472 00473 string filename3=concat_filename(FILEHEAD2, fname, dimension, MAXDIM); 00474 cout << "\n\n3dim...The following results will be written into: "<<endl; 00475 cout << filename3<<endl; 00476 00477 write_averaged_cuts_intro(filename3.c_str(), compname, GRIDSIZE, dimension, criterion); 00478 test_average_time_for_specified_cuts(filename3.c_str(), criterion, ratio, dimension, steps3, scan_N3, loops3, cuts3); 00479 00480 00481 00482 // 4dim 00483 dimension=4; 00484 const COUNTER Nsteps4=12; 00485 NUMBER scan_N4[Nsteps4]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00486 COUNTER loops4[Nsteps4]= {30 , 20 , 15, 15, 10, 10, 7, 5, 4, 4, 3, 3}; 00487 COUNTER cuts4[Nsteps4][2]={{0,5},{0,6},{0,6},{0,7},{0,7}, {1,7}, {1,7}, {2,7}, {3,7}, {3,7}, {4,7}, {4,8}}; 00488 00489 COUNTER steps4=10; 00490 string filename4=concat_filename(FILEHEAD2, fname, dimension, MAXDIM); 00491 cout << "\n\n4dim...The following results will be written into: "<<endl; 00492 cout << filename4<<endl; 00493 00494 write_averaged_cuts_intro(filename4.c_str(), compname, GRIDSIZE, dimension, criterion); 00495 test_average_time_for_specified_cuts(filename4.c_str(),criterion, ratio, dimension, steps4, scan_N4, loops4, cuts4); 00496 00497 00498 00499 // 5dim 00500 dimension=5; 00501 const COUNTER Nsteps5=12; 00502 NUMBER scan_N5[Nsteps5]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00503 COUNTER loops5[Nsteps5]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00504 COUNTER cuts5[Nsteps5][2]={{0,6},{0,6},{0,6},{0,6},{0,6},{0,6},{0,6},{2,7}, { 2,7}, {2,7}, {4,9}, {4,9}}; 00505 00506 COUNTER steps5=10; 00507 00508 string filename5=concat_filename(FILEHEAD2, fname, dimension, MAXDIM); 00509 cout << "\n\n5dim...The following results will be written into: "<<endl; 00510 cout << filename5<<endl; 00511 00512 write_averaged_cuts_intro(filename5.c_str(), compname, GRIDSIZE, dimension, criterion); 00513 test_average_time_for_specified_cuts(filename5.c_str(), criterion, ratio, dimension, steps5, scan_N5, loops5, cuts5); 00514 00515 00516 // 6dim 00517 dimension=6; 00518 const COUNTER Nsteps6=12; 00519 NUMBER scan_N6[Nsteps6]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00520 COUNTER loops6[Nsteps6]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00521 COUNTER cuts6[Nsteps6][2]={{0,6},{0,6},{0,6},{0,5},{0,5},{0,6},{0,5},{1,6}, { 2,6}, {2,7}, {2,7}, {3,9}}; 00522 00523 COUNTER steps6=10; 00524 string filename6=concat_filename(FILEHEAD2, fname, dimension, MAXDIM); 00525 cout << "\n\n6dim...The following results will be written into: "<<endl; 00526 cout << filename6<<endl; 00527 00528 write_averaged_cuts_intro(filename6.c_str(), compname, GRIDSIZE, dimension, criterion); 00529 test_average_time_for_specified_cuts(filename6.c_str(), criterion, ratio, dimension, steps6, scan_N6, loops6, cuts6); 00530 00531 00532 00533 00534 // 7dim 00535 dimension=7; 00536 const COUNTER Nsteps7=12; 00537 NUMBER scan_N7[Nsteps7]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00538 COUNTER loops7[Nsteps7]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00539 COUNTER cuts7[Nsteps7][2]={{0,4},{0,4},{0,4},{0,4},{0,4},{0,4},{0,4},{0,4}, { 0,4}, {0,5}, {0,6}, {1,6}}; 00540 00541 COUNTER steps7=10; 00542 string filename7=concat_filename(FILEHEAD2, fname, dimension, MAXDIM); 00543 cout << "\n\n7dim...The following results will be written into: "<<endl; 00544 cout << filename7<<endl; 00545 00546 write_averaged_cuts_intro(filename7.c_str(), compname, GRIDSIZE, dimension, criterion); 00547 test_average_time_for_specified_cuts(filename7.c_str(), criterion, ratio, dimension, steps7, scan_N7, loops7, cuts7); 00548 00549 */ 00550 00551 // 8dim 00552 dimension=8; 00553 const COUNTER Nsteps8=12; 00554 NUMBER scan_N8[Nsteps8]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00555 COUNTER loops8[Nsteps8]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00556 COUNTER cuts8[Nsteps8][2]={{0,5},{0,5},{0,5},{0,5},{0,5},{0,5},{0,5},{0,5}, { 0,6}, {1,5}, {1,6}, {1,6}}; 00557 00558 COUNTER steps8=9; 00559 00560 string filename8=concat_filename(FILEHEAD2, fname, dimension, MAXDIM); 00561 cout << "\n\n8dim...The following results will be written into: "<<endl; 00562 cout << filename8<<endl; 00563 00564 write_averaged_cuts_intro(filename8.c_str(), compname, GRIDSIZE, dimension, criterion); 00565 test_average_time_for_specified_cuts(filename8.c_str(), criterion, ratio, dimension, steps8, scan_N8, loops8, cuts8); 00566 00567 // 9dim 00568 dimension=9; 00569 const COUNTER Nsteps9=12; 00570 NUMBER scan_N9[Nsteps9]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00571 COUNTER loops9[Nsteps9]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00572 COUNTER cuts9[Nsteps9][2]={{0,3},{0,3},{0,3},{0,3},{0,4},{0,4},{0,4},{0,4}, { 0,5}, {1,5}, {1,6}, {1,6}}; 00573 00574 COUNTER steps9=9; 00575 00576 string filename9=concat_filename(FILEHEAD2, fname, dimension, MAXDIM); 00577 cout << "\n\n9dim...The following results will be written into: "<<endl; 00578 cout << filename9<<endl; 00579 00580 write_averaged_cuts_intro(filename9.c_str(), compname, GRIDSIZE, dimension, criterion); 00581 test_average_time_for_specified_cuts(filename9.c_str(), criterion, ratio, dimension, steps9, scan_N9, loops9, cuts9); 00582 00583 // 10dim 00584 dimension=10; 00585 const COUNTER Nsteps10=12; 00586 NUMBER scan_N10[Nsteps10]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00587 COUNTER loops10[Nsteps10]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00588 COUNTER cuts10[Nsteps10][2]={{0,3},{0,3},{0,3},{0,3},{0,4},{0,4},{0,4},{0,4}, { 0,5}, {1,5}, {1,6}, {1,6}}; 00589 00590 COUNTER steps10=8; 00591 00592 string filename10=concat_filename(FILEHEAD2, fname, dimension, MAXDIM); 00593 cout << "\n\n10dim...The following results will be written into: "<<endl; 00594 cout << filename10<<endl; 00595 write_averaged_cuts_intro(filename10.c_str(), compname, GRIDSIZE, dimension, criterion); 00596 test_average_time_for_specified_cuts(filename10.c_str(), criterion, ratio, dimension, steps10, scan_N10, loops10, cuts10); 00597 00598 // 11dim 00599 dimension=11; 00600 const COUNTER Nsteps11=12; 00601 NUMBER scan_N11[Nsteps11]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00602 COUNTER loops11[Nsteps11]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00603 COUNTER cuts11[Nsteps11][2]={{0,3},{0,3},{0,3},{0,3},{0,4},{0,4},{0,4},{0,4}, { 0,5}, {1,5}, {1,6}, {1,6}}; 00604 00605 COUNTER steps11=8; 00606 string filename11=concat_filename(FILEHEAD2, fname, dimension, MAXDIM); 00607 cout << "\n\n11dim...The following results will be written into: "<<endl; 00608 cout << filename11<<endl; 00609 00610 write_averaged_cuts_intro(filename11.c_str(), compname, GRIDSIZE, dimension, criterion); 00611 test_average_time_for_specified_cuts(filename11.c_str(), criterion, ratio, dimension, steps11, scan_N11, loops11, cuts11); 00612 00613 00614 00615 00616 /* 00617 The perfect settings for ffC: 00618 00619 // 1dim 00620 dimension=1; 00621 char filename1[]="c:\\results\\doublenumber01_11.txt"; 00622 cout << "\n\n1dim...The following results will be written into: "; 00623 cout << filename1<<endl; 00624 const COUNTER Nsteps1=12; 00625 NUMBER scan_N1[Nsteps1]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00626 COUNTER loops1[Nsteps1]= {20 , 20 , 15, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00627 COUNTER cuts1[Nsteps1][2]={{0,8},{0,8},{1,9},{3,9},{3,10},{5,10},{5,12},{7,12},{7,13}, {8,14}, {9,14}, {9,15}}; 00628 00629 write_averaged_cuts_intro(filename1, compname, GRIDSIZE, dimension); 00630 test_average_time_for_specified_cuts(filename1, criterion, ratio, dimension, Nsteps1, scan_N1, loops1, cuts1); 00631 00632 00633 // 2dim 00634 dimension=2; 00635 char filename2[]="c:\\results\\doublenumber02_11.txt"; 00636 cout << "\n\n2dim...The following results will be written into: "; 00637 cout << filename2<<endl; 00638 const COUNTER Nsteps2=12; 00639 NUMBER scan_N2[Nsteps2]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00640 COUNTER loops2[Nsteps2]= {20 , 20 , 15, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00641 COUNTER cuts2[Nsteps2][2]={{0,7},{0,7},{1,9},{3,9},{3,9},{5,9},{5,10},{7,11},{7,11}, {8,12}, {9,13}, {9,13}}; 00642 00643 write_averaged_cuts_intro(filename2, compname, GRIDSIZE, dimension); 00644 test_average_time_for_specified_cuts(filename2, criterion, ratio, dimension, Nsteps2, scan_N2, loops2, cuts2); 00645 00646 00647 // 3dim 00648 dimension=3; 00649 char filename3[]="c:\\results\\doublenumber03_11.txt"; 00650 cout << "\n\n3dim...The following results will be written into: "; 00651 cout << filename3<<endl; 00652 const COUNTER Nsteps3=12; 00653 NUMBER scan_N3[Nsteps3]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00654 COUNTER loops3[Nsteps3]= { 30 , 20 , 15, 15, 10, 10, 7, 5, 4, 4, 3, 3}; 00655 COUNTER cuts3[Nsteps3][2]={{0,7},{0,7},{1,7},{3,8}, {3,8}, {4,9},{5,9}, {6,10}, {6,10},{6,11},{6,11}, {6,12}}; 00656 00657 write_averaged_cuts_intro(filename3, compname, GRIDSIZE, dimension); 00658 test_average_time_for_specified_cuts(filename3, criterion, ratio, dimension, Nsteps3, scan_N3, loops3, cuts3); 00659 00660 00661 // 4dim 00662 dimension=4; 00663 char filename4[]="c:\\results\\doublenumber04_11.txt"; 00664 cout << "\n\n4dim...The following results will be written into: "; 00665 cout << filename4<<endl; 00666 const COUNTER Nsteps4=12; 00667 NUMBER scan_N4[Nsteps4]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00668 COUNTER loops4[Nsteps4]= {30 , 20 , 15, 15, 10, 10, 7, 5, 4, 4, 3, 3}; 00669 COUNTER cuts4[Nsteps4][2]={{0,7},{1,7},{2,7},{3,8},{3,8}, {4,8}, {4,8}, {4,8}, {4,9}, {5,10}, {5,10}, {5,12}}; 00670 00671 write_averaged_cuts_intro(filename4, compname, GRIDSIZE, dimension); 00672 test_average_time_for_specified_cuts(filename4, criterion, ratio, dimension, Nsteps4, scan_N4, loops4, cuts4); 00673 00674 00675 // 5dim 00676 dimension=5; 00677 char filename5[]="c:\\results\\doublenumber05_11.txt"; 00678 cout << "\n\n5dim...The following results will be written into: "; 00679 cout << filename5<<endl; 00680 const COUNTER Nsteps5=12; 00681 NUMBER scan_N5[Nsteps5]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00682 COUNTER loops5[Nsteps5]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00683 COUNTER cuts5[Nsteps5][2]={{0,6},{0,7},{2,7},{3,8},{3,8},{4,8},{4,8},{4,9},{5,9}, {5,9}, {5,10}, {5,11}}; 00684 00685 write_averaged_cuts_intro(filename5, compname, GRIDSIZE, dimension); 00686 test_average_time_for_specified_cuts(filename5, criterion, ratio, dimension, Nsteps5, scan_N5, loops5, cuts5); 00687 00688 00689 // 6dim 00690 dimension=6; 00691 char filename6[]="c:\\results\\doublenumber06_11.txt"; 00692 cout << "\n\n6dim...The following results will be written into: "; 00693 cout << filename6<<endl; 00694 const COUNTER Nsteps6=12; 00695 NUMBER scan_N6[Nsteps6]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00696 COUNTER loops6[Nsteps6]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00697 COUNTER cuts6[Nsteps6][2]={{0,6},{0,7},{2,7},{3,8},{3,8},{4,8},{4,8},{4,9},{5,9}, {5,9}, {5,10}, {5,11}}; 00698 00699 write_averaged_cuts_intro(filename6, compname, GRIDSIZE, dimension); 00700 test_average_time_for_specified_cuts(filename6, criterion, ratio, dimension, Nsteps6, scan_N6, loops6, cuts6); 00701 00702 00703 // 7dim 00704 dimension=7; 00705 char filename7[]="c:\\results\\doublenumber07_11.txt"; 00706 cout << "\n\n7dim...The following results will be written into: "; 00707 cout << filename7<<endl; 00708 const COUNTER Nsteps7=12; 00709 NUMBER scan_N7[Nsteps7]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00710 COUNTER loops7[Nsteps7]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00711 COUNTER cuts7[Nsteps7][2]={{0,6},{0,7},{2,7},{3,8},{3,8},{4,8},{4,8},{4,9},{5,9}, {5,9}, {5,10}, {5,11}}; 00712 00713 write_averaged_cuts_intro(filename7, compname, GRIDSIZE, dimension); 00714 test_average_time_for_specified_cuts(filename7, criterion, ratio, dimension, Nsteps7, scan_N7, loops7, cuts7); 00715 00716 // 8dim 00717 dimension=8; 00718 char filename8[]="c:\\results\\doublenumber08_11.txt"; 00719 cout << "\n\n8dim...The following results will be written into: "; 00720 cout << filename8<<endl; 00721 const COUNTER Nsteps8=12; 00722 NUMBER scan_N8[Nsteps8]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00723 COUNTER loops8[Nsteps8]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00724 COUNTER cuts8[Nsteps8][2]={{0,6},{0,7},{2,7},{3,8},{3,8},{4,8},{4,8},{4,9},{5,9}, {5,9}, {5,10}, {5,11}}; 00725 COUNTER steps8=9; 00726 write_averaged_cuts_intro(filename8, compname, GRIDSIZE, dimension); 00727 test_average_time_for_specified_cuts(filename8, criterion, ratio, dimension, steps8, scan_N8, loops8, cuts8); 00728 00729 // 9dim 00730 dimension=9; 00731 char filename9[]="c:\\results\\doublenumber09_11.txt"; 00732 cout << "\n\n9dim...The following results will be written into: "; 00733 cout << filename9<<endl; 00734 const COUNTER Nsteps9=12; 00735 NUMBER scan_N9[Nsteps9]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00736 COUNTER loops9[Nsteps9]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00737 COUNTER cuts9[Nsteps9][2]={{0,6},{0,7},{2,7},{3,8},{3,8},{4,8},{4,8},{4,9},{5,9}, {5,9}, {5,10}, {5,11}}; 00738 COUNTER steps9=9; 00739 write_averaged_cuts_intro(filename9, compname, GRIDSIZE, dimension); 00740 test_average_time_for_specified_cuts(filename9, criterion, ratio, dimension, steps9, scan_N9, loops9, cuts9); 00741 00742 // 10dim 00743 dimension=10; 00744 char filename10[]="c:\\results\\doublenumber10_11.txt"; 00745 cout << "\n\n10dim...The following results will be written into: "; 00746 cout << filename10<<endl; 00747 const COUNTER Nsteps10=12; 00748 NUMBER scan_N10[Nsteps10]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00749 COUNTER loops10[Nsteps10]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00750 COUNTER cuts10[Nsteps10][2]={{0,6},{0,7},{2,7},{3,8},{3,8},{4,8},{4,8},{4,9},{5,9}, {5,9}, {5,10}, {5,11}}; 00751 00752 COUNTER steps10=9; 00753 write_averaged_cuts_intro(filename10, compname, GRIDSIZE, dimension); 00754 test_average_time_for_specified_cuts(filename10, criterion, ratio, dimension, steps10, scan_N10, loops10, cuts10); 00755 00756 // 11dim 00757 dimension=11; 00758 char filename11[]="c:\\results\\doublenumber11_11.txt"; 00759 cout << "\n\n11dim...The following results will be written into: "; 00760 cout << filename11<<endl; 00761 const COUNTER Nsteps11=12; 00762 NUMBER scan_N11[Nsteps11]= {312, 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 480000}; 00763 COUNTER loops11[Nsteps11]= {50 , 30 , 20, 12, 10, 8, 8, 6, 4, 3, 3, 3}; 00764 COUNTER cuts11[Nsteps11][2]={{0,6},{0,7},{2,7},{3,8},{3,8},{4,8},{4,8},{4,9},{5,9}, {5,9}, {5,10}, {5,11}}; 00765 00766 COUNTER steps11=9; 00767 write_averaged_cuts_intro(filename11, compname, GRIDSIZE, dimension); 00768 test_average_time_for_specified_cuts(filename11, criterion, ratio, dimension, steps11, scan_N11, loops11, cuts11); 00769 00770 */ 00771 } 00772 00773 } // end of namespace optimize
Diploma Thesis Sourcecode
Documentation check out the text and the executable binaries |