Diploma Thesis Percolation Simulation C++ Sourcecode Documentation |
Compounds | |
class | arguments1 |
class | fillingfactor_functions |
Typedefs | |
typedef measure< REAL > | measuredouble |
Functions | |
bool | is_there_a_spanning_cluster (REAL ff, arguments1 &arg) |
int | bracket_ff (bool(*f)(REAL, arguments1 &), arguments1 &arg, REAL left, REAL right, REAL tol, measuredouble &result) |
int | find_one_ffc (REAL left, REAL right, REAL tol, sphere *spheres, NUMLIST &L_sph, string &throwtime, const char *clusteranalysis_file, measuredouble &one_ffc, clock_t &brackettime) |
bool | find_mean_ffc (NUMBER N, int dim, COUNTER at_least, REAL mean_tolerance, REAL left, REAL right, REAL loose_tolerance, const char *clusteranalysis_file, const char *bestresults_file, muvarskewkurt< REAL > &result_ffc, minmax &result_minmax) |
void | find_ffc_scanning_N_and_dim (int lowerdim, int upperdim, REAL lower_N, NUMBER upper_N, REAL tolerance, COUNTER at_least) |
void | find_ffc_frontend () |
int | find_one_ff_with_criterion (bool(*criterion)(REAL, arguments1 &), REAL parameter, REAL left, REAL right, REAL tol, sphere *spheres, NUMLIST &L_sph, string &throwtime, const char *clusteranalysis_file, measuredouble &one_ff, clock_t &brackettime) |
bool | find_mean_ff_with_criterion (bool(*criterion)(REAL, arguments1 &), REAL parameter, string namecriterion, REAL(*ff_guessed)(NUMBER, int, REAL), NUMBER N, int dim, COUNTER at_least, REAL accuracy, REAL left, REAL right, REAL loose_tolerance, const char *clusteranalysis_file, const char *bestresults_file, muvarskewkurt< REAL > &result_ff, minmax &result_minmax) |
void | find_ff_with_criterion_scanning_N_and_dim (bool(*criterion)(REAL, arguments1 &), REAL parameter, string namecriterion, REAL(*ff_guessed)(NUMBER, int, REAL), int lowerdim, int upperdim, REAL lower_N, NUMBER upper_N, REAL tolerance, COUNTER at_least) |
bool | is_there_only_one_cluster (REAL ff, arguments1 &arg) |
REAL | ff_all_in1clst_guessed (NUMBER N, int dim, REAL ratio) |
bool | is_the_numberofcl_smaller_than_a_ratio (REAL ff, arguments1 &arg) |
REAL | ffnoc_guessed (NUMBER N, int dim, REAL ratio) |
bool | is_the_biggestcluster_bigger_than_a_ratio (REAL ff, arguments1 &arg) |
REAL | ffbig_guessed (NUMBER N, int dim, REAL ratio) |
bool | is_the_incl_meancluster_bigger_than_a_ratio (REAL ff, arguments1 &arg) |
REAL | ffmean1_guessed (NUMBER N, int dim, REAL ratio) |
void | load_stepfunctions (fillingfactor_functions *stepfn) |
fillingfactor_functions | give_one_stepfunction (int num) |
void | find_ff_with_criterion_frontend () |
Variables | |
const int | N_STEPFN = 5 |
|
Definition at line 21 of file ff.h. Referenced by bracket_ff(). |
|
Definition at line 76 of file ff.h. References ASCII_PLUSMINUS, measuredouble, and REAL. Referenced by find_one_ff_with_criterion(), and find_one_ffc().
00079 { 00080 REAL l,m,r; 00081 bool fl,fm,fr; 00082 l=left; r=right; 00083 // if (l>r) swap(l, r); // ATTENTION: ok this way? 00084 if (l>r) return 2; // 00085 fl=f(l,arg); 00086 if (fl==true) return -1; // missed left (percolates already at left bracket of interval) 00087 if (l==r) return (fl==true)?-1:+1; // the percolationpoint is left:right of point==intervall 00088 fr=f(r,arg); 00089 if (fr==false) return +1; // missed right (percolates already at right bracket of interval) 00090 00091 m=l+(r-l)/2; // middle is the best guess 00092 00093 while (r-l>tol){ 00094 fm=f(m,arg); 00095 if (fm==1){ 00096 r=m; fr=fm; 00097 } 00098 else { 00099 l=m; fr=fm; 00100 } 00101 m=l+(r-l)/2; 00102 cout << "m= "<<m<<ASCII_PLUSMINUS<<(r-l)/2<<" "<<flush; 00103 } 00104 result=measuredouble (m, (r-l)/2); 00105 return 0; // and result 00106 } |
|
Definition at line 555 of file ff.h. References NUMBER, REAL, and saturating_fillingfactor(). Referenced by load_stepfunctions().
00555 { 00556 return saturating_fillingfactor(dim,N); 00557 } |
|
Definition at line 591 of file ff.h. References ff_critical_guessed(), NUMBER, and REAL. Referenced by load_stepfunctions().
00591 { 00592 return (1+ratio) * ff_critical_guessed(N, dim); 00593 } |
|
Definition at line 605 of file ff.h. References ff_critical_guessed(), NUMBER, and REAL. Referenced by load_stepfunctions().
00605 { 00606 return (1+ratio) * ff_critical_guessed(N, dim); 00607 } |
|
Definition at line 570 of file ff.h. References ff_critical_guessed(), fillingfactor_noc1percent(), NUMBER, and REAL. Referenced by load_stepfunctions().
00570 { 00571 // TODO: 00572 // interpolation between noc1% and noc90% 00573 // 00574 if (ratio==0.01) return fillingfactor_noc1percent(dim,N); 00575 else{ 00576 if (ratio >0.2) return 0.5*ff_critical_guessed(N, dim); 00577 else return 1.5*ff_critical_guessed(N, dim); 00578 } 00579 } |
|
Definition at line 657 of file ff.h. References COUNTER, find_ff_with_criterion_scanning_N_and_dim(), ff::fillingfactor_functions::fn, load_stepfunctions(), log(), MAXDIM, MAXNUMBER, N_STEPFN, ff::fillingfactor_functions::name, NUMBER, REAL, rounded(), and ff::fillingfactor_functions::theory. Referenced by main().
00657 { 00658 cout<<"Fillingfactor-Fillingstation - Hello in parameter-space!\n\n"; 00659 cout<<"\nPlease type in the range of N (number of spheres) you are interested in."<<endl; 00660 cout<<"The lower number will be doubled while <= the upper number."<<endl; 00661 cout<<"Attention: The algorithm is optimized for these N only:"<<endl; 00662 cout<<"312(type in 312.5), 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000"; 00663 cout<<endl; 00664 00665 REAL lower_N=78; NUMBER upper_N=MAXNUMBER; 00666 do{ 00667 cout<<"[1..."<<MAXNUMBER<<", 1..."<<MAXNUMBER<<"] "; 00668 cin >> lower_N>>upper_N; 00669 }while (lower_N>upper_N || lower_N<1 || upper_N<1 || lower_N>MAXNUMBER ||upper_N>MAXNUMBER); 00670 00671 cout<<"\nThanks.\nYou can now choose, which fillingfactor you want to find out:\nI want the mean\n"; 00672 cout<<"(1) critical fillingfactor (spanning-cluster from left to right)\n"; 00673 cout<<"(2) ff for which every single sphere belongs to the one big cluster\n"; 00674 cout<<"(3) ff for which the number-of-clusters == given percentage of the # of spheres\n"; 00675 cout<<"(4) ff for which the size of the biggest-cluster == given percentage of the # of spheres\n"; 00676 cout<<"(5) ff for which the mean-clustersize == given percentage of the # of spheres\n"; 00677 cout<<"Choose a number: "; 00678 int criterion=1; 00679 do { 00680 cin>>criterion; 00681 } while (criterion < 1 || criterion >5); 00682 00683 cout<<"Thanks. So be it.\n"; 00684 char buffer[5]; sprintf(buffer, "", ""); 00685 REAL percent=50; 00686 00687 if (criterion>2){ 00688 cout<<"Now please give the percentage"; 00689 REAL percent_step=100/(REAL)lower_N; 00690 do{ 00691 cout<<"[ "<<percent_step<<"% ; "<<100-percent_step<<"% ] "; 00692 cin >>percent; 00693 } while (percent<percent_step || percent>100-percent_step); 00694 if (percent<10) sprintf(buffer, "%1.0f%c", percent,'%'); 00695 else sprintf(buffer, "%2.0f%c", percent,'%'); 00696 } 00697 00698 fillingfactor_functions stepfn[N_STEPFN+1]; load_stepfunctions(stepfn); 00699 00700 string namecriterion =stepfn[criterion].name+buffer; 00701 bool (* stepfn_criterion)(REAL, arguments1&)=stepfn[criterion].fn; 00702 REAL (* ff_guessed)(NUMBER,int,REAL) =stepfn[criterion].theory; 00703 00704 cout<<"OK. GREAT! You have chosen ("<<criterion<<") >> "<<namecriterion<<" << Please remember this!"; 00705 cout<<"\n\n ... the simulation will take some time."<<endl; 00706 cout<<"The higher your wanted dimension, the slower (above dim~7 really dramatic!)!"<<endl; 00707 cout<<"Please now type in the range of dimensions you are interested in"<<endl; 00708 00709 int lowerdim=1, upperdim=MAXDIM; 00710 do{ 00711 cout<<"[1..."<<MAXDIM<<", 1..."<<MAXDIM<<"] "; 00712 cin >> lowerdim>>upperdim; 00713 }while(lowerdim>upperdim || lowerdim<1 || upperdim<1 || lowerdim>MAXDIM ||upperdim>MAXDIM); 00714 00715 cout<<"Very good.\nNow...how good shall the result be?"; 00716 cout<<"\nPlease type in the target accuracy in %"; 00717 REAL tol=5; 00718 do{ 00719 cout<<"[0.1 ... 50]"; 00720 cin >> tol; 00721 }while (tol<0.01 || tol>50 ); 00722 tol/=100.0; 00723 00724 cout<<"OK.\nNow...how many ff-values shall there be AT LEAST for each configuration?"; 00725 cout<<"\nPlease type e.g. in 30 for high N, 70 for low N: "; 00726 COUNTER at_least=50; 00727 do{ 00728 cout<<"[0 ... 150] "; 00729 cin >> at_least; 00730 }while (at_least<1); 00731 00732 cout<<"\nOK, now you can switch off the monitor to save energy..."<<endl; 00733 COUNTER confs=rounded(log((REAL)upper_N/lower_N)/log(2.0)+1)*(upperdim-lowerdim+1); 00734 cout<<"I will simulate these "<<confs<<" configurations and save the results to disk"<<endl; 00735 find_ff_with_criterion_scanning_N_and_dim(stepfn_criterion, percent/100, namecriterion, ff_guessed, 00736 lowerdim, upperdim, lower_N, upper_N, tol, at_least); 00737 } |
|
Definition at line 485 of file ff.h. References COUNTER, datafiles::create_clusteranalysis_resultfile(), datafiles::create_ff_bestresults_file(), FILEHEAD2, find_mean_ff_with_criterion(), heat_random_generator(), NUMBER, REAL, SEED7, and timestamp_fullyear(). Referenced by find_ff_with_criterion_frontend(), and commandline::start_subprg().
00488 { 00489 srand( SEED7 ); // set the random generator to a seed 00490 cout <<endl; 00491 heat_random_generator(); 00492 cout <<endl; 00493 // write File-Intro to bracket-results 00494 string clusteranalysis_file=""; 00495 clusteranalysis_file=(clusteranalysis_file+FILEHEAD2)+"single-results-" 00496 +timestamp_fullyear()+".txt"; 00497 create_clusteranalysis_resultfile(clusteranalysis_file.c_str(), namecriterion); 00498 00499 // write File-Intro to best results 00500 string bestresults_file=""; 00501 bestresults_file=bestresults_file+FILEHEAD2+"best-results_"+namecriterion+"_"+timestamp_fullyear()+".txt"; 00502 create_ff_bestresults_file(bestresults_file.c_str(), namecriterion); 00503 00504 REAL miss_tolerance=0.04; // more than these outliers on one side -> enlarge intervall (0.02) 00505 REAL shrink_last_intervall=0.15; // heuristic: doubling N decreases fluctuations by ... (0.1) 00506 00507 REAL left=0.85; // only the start intervall (for the first N in each dim) 00508 REAL right=1.25; // for high N [0.85;1.1]; for beginning with low N [0.4;1.8] 00509 // minmax for N=160000 0.96/0.83 to 1.04/1.06 (2dim/6dim) 00510 00511 int dimsteps=upperdim-lowerdim+1; 00512 minmax* intervall=new minmax[dimsteps+1]; 00513 00514 REAL ffc_theo; // set starting values for left & right 00515 int i; for (i=0;i<dimsteps+1;i++) { 00516 ffc_theo=ff_guessed((NUMBER)lower_N,lowerdim+i, parameter); 00517 intervall[i]=minmax(left*ffc_theo, right*ffc_theo); 00518 } 00519 00520 00521 muvarskewkurt<REAL> ff; minmax mm; 00522 NUMBER N; int dim; 00523 00524 for (REAL N_=lower_N;N_<=upper_N;N_*=2){ 00525 N=(NUMBER)floor(N_); 00526 00527 for (dim=lowerdim;dim<upperdim+1;dim++){ 00528 mm=intervall[dim-lowerdim]; 00529 left=mm.min; right=mm.max; 00530 find_mean_ff_with_criterion(criterion, parameter, namecriterion, ff_guessed, 00531 N, dim, at_least, tolerance, 00532 left, right, miss_tolerance, 00533 clusteranalysis_file.c_str(), bestresults_file.c_str(), 00534 ff, mm); 00535 intervall[dim-lowerdim]=minmax(mm.min+(ff.mu.av()-mm.min)*shrink_last_intervall, 00536 mm.max-(mm.max-ff.mu.av())*shrink_last_intervall) ; 00537 } 00538 } 00539 delete[] intervall; 00540 } |
|
Definition at line 290 of file ff.h. References COUNTER, find_ffc_scanning_N_and_dim(), log(), MAXDIM, MAXNUMBER, NUMBER, REAL, and rounded(). Referenced by main().
00290 { 00291 cout<<"Hello!\nThe simulation will take some time."<<endl; 00292 cout<<"The higher the wanted dimension, the slower!"<<endl; 00293 cout<<"Please type in the range of dimensions you are interested in"<<endl; 00294 00295 int lowerdim=1, upperdim=MAXDIM; 00296 do{ 00297 cout<<"[1..."<<MAXDIM<<", 1..."<<MAXDIM<<"] "; 00298 cin >> lowerdim>>upperdim; 00299 }while(lowerdim>upperdim || lowerdim<1 || upperdim<1 || lowerdim>MAXDIM ||upperdim>MAXDIM); 00300 cout<<"\nThanks.\nNow type in the range of N (number of spheres) you are interested in."<<endl; 00301 cout<<"The lower number will be doubled while <= the upper number."<<endl; 00302 cout<<"Attention: The algorithm is optimized for these N only:"<<endl; 00303 cout<<"312(type in 312.5), 625, 1250, 2500, 5000, 10000, 20000, 40000, 80000, 160000, 320000"; 00304 cout<<endl; 00305 00306 REAL lower_N=78; NUMBER upper_N=MAXNUMBER; 00307 do{ 00308 cout<<"[1..."<<MAXNUMBER<<", 1..."<<MAXNUMBER<<"] "; 00309 cin >> lower_N>>upper_N; 00310 }while (lower_N>upper_N || lower_N<1 || upper_N<1 || lower_N>MAXNUMBER ||upper_N>MAXNUMBER); 00311 00312 cout<<"Very good.\nNow...how good shall the result be?"; 00313 cout<<"\nPlease type in the target accuracy in %"; 00314 REAL tol=5; 00315 do{ 00316 cout<<"[0.1 ... 50]"; 00317 cin >> tol; 00318 }while (tol<0.01 || tol>50 ); 00319 tol/=100.0; 00320 00321 cout<<"OK.\nNow...how many ff-values shall there be AT LEAST for each configuration?"; 00322 cout<<"\nPlease type e.g. in 50 for high N, 150 for low N: "; 00323 COUNTER at_least=50; 00324 do{ 00325 cout<<"[0 ... 150] "; 00326 cin >> at_least; 00327 }while (at_least<1); 00328 00329 cout<<"\nOK, now you can switch off the monitor to save energy..."<<endl; 00330 COUNTER confs=rounded(log((REAL)upper_N/lower_N)/log(2.0)+1)*(upperdim-lowerdim+1); 00331 cout<<"I will simulate these "<<confs<<" configurations and save the results to disk"<<endl; 00332 find_ffc_scanning_N_and_dim(lowerdim, upperdim, lower_N, upper_N, tol, at_least); 00333 } |
|
Definition at line 238 of file ff.h. References COUNTER, datafiles::create_clusteranalysis_resultfile(), datafiles::create_ffc_bestresults_file(), ff_critical_guessed(), FILEHEAD2, find_mean_ffc(), heat_random_generator(), NUMBER, REAL, SEED7, and timestamp_fullyear(). Referenced by find_ffc_frontend().
00239 { 00240 srand( SEED7 ); // set the random generator to a seed 00241 cout <<endl; 00242 heat_random_generator(); 00243 cout <<endl; 00244 // write File-Intro to bracket-results 00245 string clusteranalysis_file=""; 00246 clusteranalysis_file=(clusteranalysis_file+FILEHEAD2)+"single-results-" 00247 +timestamp_fullyear()+".txt"; 00248 create_clusteranalysis_resultfile(clusteranalysis_file.c_str(), "critical"); 00249 00250 // write File-Intro to best results 00251 string bestresults_file=""; 00252 bestresults_file=(bestresults_file+FILEHEAD2)+"best-results-"+timestamp_fullyear()+".txt"; 00253 create_ffc_bestresults_file(bestresults_file.c_str()); 00254 00255 REAL miss_tolerance=0.04; // more than these outliers on one side -> enlarge intervall (0.02) 00256 REAL shrink_last_intervall=0.1; // heuristic: doubling N decreases fluctuations by ... (0.1) 00257 00258 REAL left=0.93; // only the start intervall (for the first N in each dim) 00259 REAL right=1.03; // for high N [0.85;1.1]; for beginning with low N [0.4;1.8] 00260 // minmax for N=160000 0.96/0.83 to 1.04/1.06 (2dim/6dim) 00261 00262 int dimsteps=upperdim-lowerdim+1; 00263 minmax* intervall=new minmax[dimsteps+1]; 00264 REAL ffc_theo; // set starting values for left & right 00265 int i; for (i=0;i<dimsteps+1;i++) { 00266 ffc_theo=ff_critical_guessed((NUMBER)lower_N,lowerdim+i); 00267 intervall[i]=minmax(left*ffc_theo, right*ffc_theo); 00268 } 00269 00270 muvarskewkurt<REAL> ffc; minmax mm; 00271 NUMBER N; int dim; 00272 00273 for (REAL N_=lower_N;N_<=upper_N;N_*=2){ 00274 N=(NUMBER)floor(N_); 00275 00276 for (dim=lowerdim;dim<upperdim+1;dim++){ 00277 mm=intervall[dim-lowerdim]; 00278 left=mm.min; right=mm.max; 00279 find_mean_ffc(N, dim, at_least, tolerance, 00280 left, right, miss_tolerance, 00281 clusteranalysis_file.c_str(), bestresults_file.c_str(), 00282 ffc, mm); 00283 intervall[dim-lowerdim]=minmax(mm.min+(ffc.mu.av()-mm.min)*shrink_last_intervall, 00284 mm.max-(mm.max-ffc.mu.av())*shrink_last_intervall) ; 00285 } 00286 } 00287 delete[] intervall; 00288 } |
|
Definition at line 368 of file ff.h. References ASCII_PLUSMINUS, measure< REAL >::av(), COUNTER, datafiles::create_ff_file(), FILEHEAD2, find_one_ff_with_criterion(), give_short_timestamp(), GRIDSIZE, increasing_integers(), NUMBER, REAL, measure< REAL >::sdev(), set_dim(), throw_spheres(), datafiles::write_best_ff_line(), datafiles::write_best_ff_outofmemory(), and datafiles::write_ff_line(). Referenced by find_ff_with_criterion_scanning_N_and_dim().
00374 { 00375 sphere *spheres = new sphere[N+1]; 00376 if (spheres==NULL) { 00377 write_best_ff_outofmemory(bestresults_file,N,dim, 00378 ("find_"+namecriterion+"(...): sphere *spheres").c_str()); 00379 result_minmax=minmax(left,right); 00380 return false; 00381 } 00382 00383 set_dim(spheres,0,N,dim); 00384 NUMLIST all; increasing_integers (all, N); 00385 00386 cout <<"\nN="<<N<<" dim="<<dim<<" Create the datafile..."<<endl; 00387 char buffer[100]; 00388 sprintf(buffer, "-%ddim-N%d-M%d-T%1.3f.txt", 00389 dim, N, at_least, accuracy); 00390 string fn=""; fn=FILEHEAD2+namecriterion+buffer; 00391 create_ff_file(fn.c_str(), namecriterion); 00392 00393 REAL ff_theo=ff_guessed(N,dim, parameter); 00394 REAL tolerance_absolute=accuracy*ff_theo; 00395 00396 cout<<"Now I find the "<<namecriterion<<" of single realizations in ("<<left<<", "<<right<<") with "; 00397 cout<<ASCII_PLUSMINUS<<tolerance_absolute<<" ("<<tolerance_absolute/ff_theo*100<<"%)"<<endl; 00398 cout<<"until the mean is found "<<ASCII_PLUSMINUS<<accuracy*ff_theo; 00399 cout<<" ("<<accuracy*100<<"%)\n"<<endl; 00400 00401 measuredouble one_ff; 00402 std::list<REAL> results; 00403 muvarskewkurt<REAL> ff; 00404 minmax mm; // use only once! then .reset() ! 00405 00406 string throwtime; 00407 COUNTER nn=1; 00408 COUNTER missedleft=0;COUNTER missedright=0; 00409 REAL errorsum=0; 00410 string foundtime; 00411 00412 clock_t totaltime, brackettime, intervalltime; 00413 totaltime=clock(); 00414 int missed; 00415 REAL new_shot=2.0; // if missed, then double/half that intervall border 00416 REAL enlarger=0.05; // too many outliers -> add 5% to intervall border 00417 REAL l,r; // temporary left, right until missed==0 00418 REAL dummy=1.0; // for calculate_moments result type 00419 00420 do{ // until accurracy of mean sufficient 00421 throw_spheres(spheres, all); 00422 throwtime=give_short_timestamp(); 00423 brackettime=0; 00424 l=left; r=right; 00425 // the 'theoretical' value (if it is to big) is only used for the first 5 single_ff's 00426 if (nn>5) tolerance_absolute=accuracy * minof2<REAL>(ff_theo, ff.mu.av()); 00427 00428 do{ // until single realization bracketed (== not missed) 00429 missed=find_one_ff_with_criterion(criterion, parameter, 00430 l, r, tolerance_absolute, spheres, all, throwtime, 00431 clusteranalysis_file, one_ff, intervalltime); 00432 brackettime+=intervalltime; 00433 00434 if (missed==-1) { 00435 cout<<"mL "<<flush; 00436 missedleft++; 00437 l/=new_shot; // for this realization only 00438 if (missedleft/(REAL)nn>loose_tolerance) { 00439 left-=left*enlarger; 00440 cout<<" eL<<< ("<<left<<", "<<right<<")"<<flush; } 00441 } 00442 if (missed==+1) { 00443 cout<<"mR "<<flush; 00444 missedright++; 00445 r*=new_shot; // for this realization only 00446 if (missedright/(REAL)nn>loose_tolerance) { 00447 right+=right*enlarger; 00448 cout<<" eR>>> ("<<left<<", "<<right<<")"<<flush; } 00449 } 00450 if (missed==2) { 00451 cout<<"\nError: left bracket > right bracket (Please mail: cpp__at__AndreasKrueger__dot__de)\n"<<endl; 00452 exit(2); 00453 } 00454 } while (missed!=0); 00455 00456 mm.set_if_more_extreme(one_ff.av()); 00457 errorsum+=one_ff.sdev(); 00458 results.push_back(one_ff.av()); 00459 00460 ff=calculate_moments<REAL,REAL>(&manipdata<REAL>::linear, (REAL)42, results, dummy); 00461 ff.mu.set_sdev(ff.mu.sdev()+errorsum/nn); // add the mean measurement error 00462 ff.sdev_of_mean(nn); // this reduces the dev's to ~1/sqrt(nn) 00463 foundtime=give_short_timestamp(); 00464 00465 write_ff_line(fn.c_str(),N,dim, GRIDSIZE, one_ff, brackettime, 00466 nn, missedleft, missedright, ff, foundtime.c_str()); 00467 00468 cout<<"\nloop_"<<nn<<" (ml:"<<missedleft<<", mr:"<<missedright<<") mu="; 00469 cout<<ff.mu<<"\t (N="<<N<<", dim="<<dim<<")"<<endl<<endl; 00470 00471 nn++; 00472 00473 }while (nn<=at_least || ff.mu.sdev()>accuracy*ff.mu.av()); 00474 00475 totaltime=clock()-totaltime; 00476 write_best_ff_line(bestresults_file,N,dim,GRIDSIZE, ff, nn-1, missedleft, missedright, 00477 mm.min, mm.max, totaltime, foundtime.c_str()); 00478 00479 result_ff=ff; result_minmax=mm; 00480 // return-by-reference: ffc and result_minmax 00481 return true; 00482 } |
|
Definition at line 128 of file ff.h. References ASCII_PLUSMINUS, measure< REAL >::av(), COUNTER, datafiles::create_ffc_file(), ff_critical_guessed(), FILEHEAD2, find_one_ffc(), give_short_timestamp(), GRIDSIZE, increasing_integers(), NUMBER, REAL, measure< REAL >::sdev(), set_dim(), throw_spheres(), datafiles::write_best_ff_line(), datafiles::write_best_ff_outofmemory(), and datafiles::write_ff_line(). Referenced by find_ffc_scanning_N_and_dim().
00132 { 00133 sphere *spheres = new sphere[N+1]; 00134 if (spheres==NULL) { 00135 write_best_ff_outofmemory(bestresults_file,N,dim, 00136 "find_ffc(...): sphere *spheres"); 00137 result_minmax=minmax(left,right); 00138 return false; 00139 } 00140 00141 set_dim(spheres,0,N,dim); 00142 NUMLIST all; increasing_integers (all, N); 00143 00144 cout <<"\nN="<<N<<" dim="<<dim<<" Create the datafile..."<<endl; 00145 char buffer[100]; 00146 sprintf(buffer, "ffc-%ddim-N%d-M%d-T%1.3f.txt", 00147 dim, N, at_least, mean_tolerance); 00148 string fn=""; fn=fn+FILEHEAD2+buffer; 00149 create_ffc_file(fn.c_str()); 00150 00151 REAL ffc_theo=ff_critical_guessed(N,dim); 00152 REAL tolerance_absolute=mean_tolerance*ffc_theo; 00153 00154 cout<<"Now I find the ffc of single realizations in ("<<left<<", "<<right<<") with "; 00155 cout<<ASCII_PLUSMINUS<<tolerance_absolute<<" ("<<tolerance_absolute/ffc_theo*100<<"%)"<<endl; 00156 cout<<"until the mean is found "<<ASCII_PLUSMINUS<<mean_tolerance*ffc_theo; 00157 cout<<" ("<<mean_tolerance*100<<"%)\n"<<endl; 00158 00159 measuredouble one_ffc; 00160 std::list<REAL> results; 00161 muvarskewkurt<REAL> ffc; 00162 minmax mm; // use only once! then .reset() ! 00163 00164 string throwtime; 00165 COUNTER nn=1; 00166 COUNTER missedleft=0;COUNTER missedright=0; 00167 REAL errorsum=0; 00168 string foundtime; 00169 00170 clock_t totaltime, brackettime, intervalltime; 00171 totaltime=clock(); 00172 int missed; 00173 REAL new_shot=2.0; // if missed, then double/half that intervall border 00174 REAL enlarger=0.05; // too many outliers -> add 5% to intervall border 00175 REAL l,r; // temporary left, right until missed==0 00176 REAL dummy=1.0; // for calculate_moments result type 00177 00178 do{ // until accurracy of mean sufficient 00179 throw_spheres(spheres, all); 00180 throwtime=give_short_timestamp(); 00181 brackettime=0; 00182 l=left; r=right; 00183 do{ // until single realization bracketed (= not missed) 00184 missed=find_one_ffc(l, r, tolerance_absolute, spheres, all, throwtime, // 00185 clusteranalysis_file, one_ffc, intervalltime); 00186 brackettime+=intervalltime; 00187 00188 if (missed==-1) { 00189 cout<<"mL "<<flush; 00190 missedleft++; 00191 l/=new_shot; // for this realization only 00192 if (missedleft/(REAL)nn>loose_tolerance) { 00193 left-=left*enlarger; 00194 cout<<" eL<<< ("<<left<<", "<<right<<")"<<flush; } 00195 } 00196 if (missed==+1) { 00197 cout<<"mR "<<flush; 00198 missedright++; 00199 r*=new_shot; // for this realization only 00200 if (missedright/(REAL)nn>loose_tolerance) { 00201 right+=right*enlarger; 00202 cout<<" eR>>> ("<<left<<", "<<right<<")"<<flush; } 00203 } 00204 if (missed==2) { 00205 cout<<"\nError: left bracket > right bracket (Please mail: cpp__at__AndreasKrueger__dot__de)\n"<<endl; 00206 exit(2); 00207 } 00208 } while (missed!=0); 00209 00210 mm.set_if_more_extreme(one_ffc.av()); 00211 errorsum+=one_ffc.sdev(); 00212 results.push_back(one_ffc.av()); 00213 00214 ffc=calculate_moments<REAL,REAL>(&manipdata<REAL>::linear, (REAL)42, results, dummy); 00215 ffc.mu.set_sdev(ffc.mu.sdev()+errorsum/nn); // add the mean measurement error 00216 ffc.sdev_of_mean(nn); // this reduces the dev's to ~1/sqrt(nn) 00217 foundtime=give_short_timestamp(); 00218 00219 write_ff_line(fn.c_str(),N,dim, GRIDSIZE, one_ffc, brackettime, 00220 nn, missedleft, missedright, ffc, foundtime.c_str()); 00221 00222 cout<<"\nloop_"<<nn<<" (ml:"<<missedleft<<", mr:"<<missedright<<") mu="; 00223 cout<<ffc.mu<<"\t (N="<<N<<", dim="<<dim<<")"<<endl<<endl; 00224 00225 nn++; 00226 }while (nn<=at_least || ffc.mu.sdev()>mean_tolerance*ffc.mu.av()); 00227 00228 totaltime=clock()-totaltime; 00229 write_best_ff_line(bestresults_file,N,dim,GRIDSIZE, ffc, nn-1, missedleft, missedright, 00230 mm.min, mm.max, totaltime, foundtime.c_str()); 00231 00232 result_ffc=ffc; result_minmax=mm; 00233 // return-by-reference: ffc and result_minmax 00234 return true; 00235 } |
|
Definition at line 347 of file ff.h. References bracket_ff(), getdim(), NUMBER, and REAL. Referenced by find_mean_ff_with_criterion().
00350 { 00351 00352 NUMBER N=L_sph.size(); 00353 int dim=getdim(spheres[L_sph.front()]); 00354 00355 REAL dummy=42; 00356 arguments1 arg(N,dim,spheres, &L_sph, dummy, &throwtime, clusteranalysis_file, parameter); 00357 measuredouble ff; 00358 00359 brackettime=clock(); 00360 int missed=bracket_ff(criterion, arg, left,right, tol, ff); 00361 brackettime=clock()-brackettime; 00362 00363 if (missed==0) one_ff=ff; 00364 else one_ff=0; 00365 return missed; 00366 } |
|
Definition at line 108 of file ff.h. References bracket_ff(), getdim(), is_there_a_spanning_cluster(), NUMBER, and REAL. Referenced by find_mean_ffc().
00110 { 00111 00112 NUMBER N=L_sph.size(); 00113 int dim=getdim(spheres[L_sph.front()]); 00114 00115 REAL dummy=42; 00116 arguments1 arg(N,dim,spheres, &L_sph, dummy, &throwtime, clusteranalysis_file, dummy); 00117 measuredouble ffc; 00118 00119 brackettime=clock(); 00120 int missed=bracket_ff(&is_there_a_spanning_cluster, arg, left,right, tol, ffc); 00121 brackettime=clock()-brackettime; 00122 00123 if (missed==0) one_ffc=ffc; 00124 else one_ffc=0; 00125 return missed; 00126 } |
|
Definition at line 641 of file ff.h. References ff::fillingfactor_functions::fn, load_stepfunctions(), N_STEPFN, ff::fillingfactor_functions::name, and ff::fillingfactor_functions::theory. Referenced by optimize::test_average_time_for_specified_cuts().
00641 { 00642 fillingfactor_functions all_stepfns[N_STEPFN+1]; 00643 load_stepfunctions(all_stepfns); 00644 00645 fillingfactor_functions stepfn; 00646 stepfn.name=all_stepfns[num].name; 00647 stepfn.fn=all_stepfns[num].fn; 00648 stepfn.theory=all_stepfns[num].theory; 00649 00650 return stepfn; 00651 } |
|
Definition at line 581 of file ff.h. References ff::arguments1::clusteranalysis_file, ff::arguments1::dim, give_radius(), GRIDSIZE, ff::arguments1::L_sph_numbers, ff::arguments1::N, ff::arguments1::parameter, REAL, counters::setR_count_analyze_step(), ff::arguments1::spheres, ff::arguments1::throwtime, and datafiles::write_one_result(). Referenced by load_stepfunctions().
00581 { 00582 REAL RaDIuS=give_radius(ff, arg.N, GRIDSIZE, arg.dim); 00583 one_result step; 00584 clock_t dummy1, dummy2; 00585 step= setR_count_analyze_step(arg.N, arg.dim, arg.spheres, 00586 *(arg.L_sph_numbers), RaDIuS, *arg.throwtime, dummy1, dummy2); 00587 write_one_result(arg.clusteranalysis_file, ff, step, arg.N, arg.dim, GRIDSIZE); 00588 00589 return (step.biggest_clsz > arg.N * arg.parameter); 00590 } |
|
Definition at line 595 of file ff.h. References ff::arguments1::clusteranalysis_file, ff::arguments1::dim, give_radius(), GRIDSIZE, ff::arguments1::L_sph_numbers, ff::arguments1::N, ff::arguments1::parameter, REAL, counters::setR_count_analyze_step(), ff::arguments1::spheres, ff::arguments1::throwtime, and datafiles::write_one_result(). Referenced by load_stepfunctions().
00595 { 00596 REAL RaDIuS=give_radius(ff, arg.N, GRIDSIZE, arg.dim); 00597 one_result step; 00598 clock_t dummy1, dummy2; 00599 step= setR_count_analyze_step(arg.N, arg.dim, arg.spheres, 00600 *(arg.L_sph_numbers), RaDIuS, *arg.throwtime, dummy1, dummy2); 00601 write_one_result(arg.clusteranalysis_file, ff, step, arg.N, arg.dim, GRIDSIZE); 00602 00603 return (step.mean_clsz > arg.N * arg.parameter); 00604 } |
|
Definition at line 560 of file ff.h. References ff::arguments1::clusteranalysis_file, ff::arguments1::dim, give_radius(), GRIDSIZE, ff::arguments1::L_sph_numbers, ff::arguments1::N, ff::arguments1::parameter, REAL, counters::setR_count_analyze_step(), ff::arguments1::spheres, ff::arguments1::throwtime, and datafiles::write_one_result(). Referenced by load_stepfunctions().
00560 { 00561 REAL RaDIuS=give_radius(ff, arg.N, GRIDSIZE, arg.dim); 00562 one_result step; 00563 clock_t dummy1, dummy2; 00564 step= setR_count_analyze_step(arg.N, arg.dim, arg.spheres, 00565 *(arg.L_sph_numbers), RaDIuS, *arg.throwtime, dummy1, dummy2); 00566 write_one_result(arg.clusteranalysis_file, ff, step, arg.N, arg.dim, GRIDSIZE); 00567 00568 return (step.numberof_cl < arg.N * arg.parameter); 00569 } |
|
Definition at line 59 of file ff.h. References ff::arguments1::clusteranalysis_file, ff::arguments1::dim, give_radius(), GRIDSIZE, ff::arguments1::L_sph_numbers, ff::arguments1::N, REAL, counters::setR_count_analyze_step(), ff::arguments1::spheres, ff::arguments1::throwtime, and datafiles::write_one_result(). Referenced by find_one_ffc(), and load_stepfunctions().
00059 { 00060 REAL RaDIuS=give_radius(ff, arg.N, GRIDSIZE, arg.dim); 00061 one_result step; 00062 clock_t dummy1, dummy2; 00063 00064 step= setR_count_analyze_step(arg.N, arg.dim, arg.spheres, 00065 *(arg.L_sph_numbers), RaDIuS, *arg.throwtime, dummy1, dummy2); 00066 00067 write_one_result(arg.clusteranalysis_file, ff, step, arg.N, arg.dim, GRIDSIZE); 00068 00069 return step.perc_lr(); 00070 } |
|
Definition at line 544 of file ff.h. References ff::arguments1::clusteranalysis_file, ff::arguments1::dim, give_radius(), GRIDSIZE, ff::arguments1::L_sph_numbers, ff::arguments1::N, REAL, counters::setR_count_analyze_step(), ff::arguments1::spheres, ff::arguments1::throwtime, and datafiles::write_one_result(). Referenced by load_stepfunctions().
00544 { 00545 REAL RaDIuS=give_radius(ff, arg.N, GRIDSIZE, arg.dim); 00546 one_result step; 00547 clock_t dummy1, dummy2; 00548 step= setR_count_analyze_step(arg.N, arg.dim, arg.spheres, 00549 *(arg.L_sph_numbers), RaDIuS, *arg.throwtime, dummy1, dummy2); 00550 write_one_result(arg.clusteranalysis_file, ff, step, arg.N, arg.dim, GRIDSIZE); 00551 00552 return (step.numberof_cl == 1); 00553 } |
|
|
Definition at line 617 of file ff.h. Referenced by find_ff_with_criterion_frontend(), and give_one_stepfunction(). |
Diploma Thesis Sourcecode
Documentation check out the text and the executable binaries |