-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptimize_cr_belief.m
48 lines (41 loc) · 1.87 KB
/
optimize_cr_belief.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function [p] = optimize_cr_belief(belief, precision)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% function: optimize_cr_belief %
% author: Federico Chiariotti ([email protected]) %
% license: GPLv3 %
% %
% %
% %
% Optimize CR transmission probability through bisection search using the %
% belief PMF over the number of colliders %
% %
% Inputs: %
% -belief: the collider number belief PMF [1 x N] %
% -precision: the required precision on the output [scalar] %
% %
% Outputs: %
% -p: the transmission probability [scalar] %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
p_low = 0;
p_high = 1;
N = length(belief);
if (N == 1)
p = 1;
return;
end
% Bisection search over the expected resolution time
while (p_low < p_high - precision)
p = (p_high + p_low) / 2;
val = belief(1) / p ^ 2;
for c = 2 : N
val = val + belief(c) * (1 - c * p) / (c * p ^ 2 * (1 - p) ^ c);
end
if (val > 0)
p_low = p;
else
p_high = p;
end
end
end