@@ -267,6 +267,7 @@ void SBF::PrintFilter(int mode)
267267 printf (" Filter sparsity: %.5f\n " ,this ->GetFilterSparsity ());
268268 printf (" Filter a-priori fpp: %.5f\n " , this ->GetFilterAPrioriFpp ());
269269 printf (" Filter fpp: %.5f\n " ,this ->GetFilterFpp ());
270+ printf (" Filter a-priori safeness probability: %.5f\n " , this ->safeness );
270271 printf (" Number of mapped elements: %d\n " ,this ->members );
271272 printf (" Number of hash collisions: %d\n " ,this ->collisions );
272273
@@ -302,7 +303,7 @@ void SBF::PrintFilter(int mode)
302303
303304 printf (" \n Emersion, Fpp, Isep:\n " );
304305 for (int j = 1 ; j < this ->AREA_number +1 ; j++){
305- printf (" Area %d: expected emersion %.5f, emersion %.5f, a-priori fpp %.5f, fpp %.5f, a-priori isep %.5f, expected ise %.5f, isep %.5f" ,j,this ->GetExpectedAreaEmersion (j),this ->GetAreaEmersion (j),this ->AREA_a_priori_fpp [j],this ->AREA_fpp [j],this ->AREA_a_priori_isep [j], this ->AREA_a_priori_isep [j]*this ->AREA_members [j], this ->AREA_isep [j]);
306+ printf (" Area %d: expected emersion %.5f, emersion %.5f, a-priori fpp %.5f, fpp %.5f, a-priori isep %.5f, expected ise %.5f, isep %.5f, a-priori safep %.5f " ,j,this ->GetExpectedAreaEmersion (j),this ->GetAreaEmersion (j),this ->AREA_a_priori_fpp [j],this ->AREA_fpp [j],this ->AREA_a_priori_isep [j], this ->AREA_a_priori_isep [j]*this ->AREA_members [j], this ->AREA_isep [j], this -> AREA_a_priori_safep [j]);
306307 printf (" \n " );
307308 }
308309 printf (" \n " );
@@ -335,11 +336,12 @@ void SBF::SaveToDisk(std::string path, int mode)
335336 myfile << " sparsity" << " ;" << this ->GetFilterSparsity () << std::endl;
336337 myfile << " a-priori fpp" << " ;" << this ->GetFilterAPrioriFpp () << std::endl;
337338 myfile << " fpp" << " ;" << this ->GetFilterFpp () << std::endl;
339+ myfile << " a-priori safeness probability" << " ;" << this ->safeness << std::endl;
338340 // area-related parameters:
339- // area,members,expected cells,self-collisions,cells,expected emersion,emersion,a-priori fpp,fpp,a-priori isep,expected ise,isep
340- myfile << " area" << " ;" << " members" << " ;" << " expected cells" << " ;" << " self-collisions" << " ;" << " cells" << " ;" << " expected emersion" << " ;" << " emersion" << " ;" << " a-priori fpp" << " ;" << " fpp" << " ;" << " a-priori isep" << " ;" << " expected ise" << " ;" << " isep" << std::endl;
341+ // area,members,expected cells,self-collisions,cells,expected emersion,emersion,a-priori fpp,fpp,a-priori isep,expected ise,isep,a-priori safep
342+ myfile << " area" << " ;" << " members" << " ;" << " expected cells" << " ;" << " self-collisions" << " ;" << " cells" << " ;" << " expected emersion" << " ;" << " emersion" << " ;" << " a-priori fpp" << " ;" << " fpp" << " ;" << " a-priori isep" << " ;" << " expected ise" << " ;" << " isep" << " ; " << " a-priori safep " << std::endl;
341343 for (int j = 1 ; j < this ->AREA_number +1 ; j++){
342- myfile << j << " ;" << this ->AREA_members [j] << " ;" << this ->AREA_expected_cells [j] << " ;" << this ->AREA_self_collisions [j] << " ;" << this ->AREA_cells [j] << " ;" << this ->GetExpectedAreaEmersion (j) << " ;" << this ->GetAreaEmersion (j) << " ;" << this ->AREA_a_priori_fpp [j] << " ;" << this ->AREA_fpp [j] << " ;" << this ->AREA_a_priori_isep [j] << " ;" << (float )this ->AREA_members [j] * this ->AREA_a_priori_isep [j] << " ;" << (float )this ->AREA_isep [j] << std::endl;
344+ myfile << j << " ;" << this ->AREA_members [j] << " ;" << this ->AREA_expected_cells [j] << " ;" << this ->AREA_self_collisions [j] << " ;" << this ->AREA_cells [j] << " ;" << this ->GetExpectedAreaEmersion (j) << " ;" << this ->GetAreaEmersion (j) << " ;" << this ->AREA_a_priori_fpp [j] << " ;" << this ->AREA_fpp [j] << " ;" << this ->AREA_a_priori_isep [j] << " ;" << (float )this ->AREA_members [j] * this ->AREA_a_priori_isep [j] << " ;" << (float )this ->AREA_isep [j] << " ; " << this -> AREA_a_priori_safep [j] << std::endl;
343345 }
344346
345347 }
@@ -489,11 +491,14 @@ int SBF::Check(char *string, int size)
489491
490492
491493// Computes a-priori area-specific inter-set error probability (a_priori_isep)
494+ // Computes a-priori area-specific safeness probability (a_priori_safep) and
495+ // the overall safeness probability for the entire filter
492496void SBF::SetAPrioriAreaIsep ()
493497{
494- double p ;
498+ double p1, p2, p3 ;
495499 int nfill;
496500
501+ p3 = 1 ;
497502
498503 for (int i = this ->AREA_number ; i>0 ; i--) {
499504 nfill = 0 ;
@@ -502,13 +507,22 @@ void SBF::SetAPrioriAreaIsep()
502507 nfill += this ->AREA_members [j];
503508 }
504509
505- p = (double )(1 - 1 / (double )this ->cells );
506- p = (double )(1 - (double )pow (p , this ->HASH_number *nfill));
507- p = (double )pow (p , this ->HASH_number );
510+ p1 = (double )(1 - 1 / (double )this ->cells );
511+ p1 = (double )(1 - (double )pow (p1 , this ->HASH_number *nfill));
512+ p1 = (double )pow (p1 , this ->HASH_number );
508513
509- this ->AREA_a_priori_isep [i] = (float )p;
514+ p2 = (double )(1 - p1);
515+ p2 = (double )pow (p2, this ->AREA_members [i]);
516+
517+ p3 *= p2;
518+
519+ this ->AREA_a_priori_isep [i] = (float )p1;
520+ this ->AREA_a_priori_safep [i] = (float )p2;
510521
511522 }
523+
524+ this ->safeness = (float )p3;
525+
512526}
513527
514528
0 commit comments