[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: rps profiler: improve compu
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: rps profiler: improve computation of sampling probability |
Date: |
Mon, 09 Apr 2018 20:44:08 +0200 |
This is an automated email from the git hooks/post-receive script.
julius-buenger pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 9d7a72525 rps profiler: improve computation of sampling probability
9d7a72525 is described below
commit 9d7a72525b8a08f16d1c711fc6cbd267bb5ee9ee
Author: Julius Bünger <address@hidden>
AuthorDate: Mon Apr 9 20:43:17 2018 +0200
rps profiler: improve computation of sampling probability
---
src/rps/test_rps.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index b46fc0c1e..2b5e4a8c3 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -1870,7 +1870,10 @@ static uint32_t fac (uint32_t x)
static uint32_t binom (uint32_t n, uint32_t k)
{
- GNUNET_assert (n >= k);
+ //GNUNET_assert (n >= k);
+ if (k > n) return 0;
+ if (0 > n) return 0;
+ if (0 > k) return 0;
if (0 == k) return 1;
return fac (n)
/
@@ -1984,11 +1987,13 @@ static void compute_probabilities (uint32_t peer_idx)
prob_push = 0;
}
/* 2. Probability of peer i being contained in pulls */
- // FIXME this computation is not yet correct
view_size = rps_peers[peer_idx].cur_view_count;
cont_views = count_containing_views (i, peer_idx);
- prob_pull = 1.0 -
- (1.0 / binom (view_size, 0.45 * view_size));
+ prob_pull = 1.0
+ /
+ (binom (view_size, 0.45 * view_size) -
+ binom (view_size - cont_views, 0.45 * view_size));
+ if (0 == cont_views) prob_pull = 0;
probs[i] = prob_push + prob_pull - (prob_push * prob_pull);
if (0 != probs[i]) count_non_zero_prob++;
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: rps profiler: improve computation of sampling probability,
gnunet <=