-
Notifications
You must be signed in to change notification settings - Fork 14
/
testPlotBudgetAlloc.m
59 lines (41 loc) · 1.17 KB
/
testPlotBudgetAlloc.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
49
50
51
52
53
54
%=========================================
% plot two figures of privacy budget allocation schemes
% for stisfying the desired TPL
% 05-Dec-2017 author: Yang Cao
%=========================================
addpath('tools/');
clc;
clear;
T=30;
%% initialize random TMs
n=10;
m=abs(normrnd(1,1,n,n));
di=sum(m, 2);
TM_B=bsxfun(@rdivide, m, di);
m=abs(normrnd(2,1,n,n));
di=sum(m, 2);
TM_F=bsxfun(@rdivide, m, di);
%% precomputation
a1=0;
an=100;
[EspMatrix_B, qM_B, dM_B, QDplusInd_B]= preCompQDMatrix(TM_B);
[aArrMax_B, qArrMax_B, dArrMax_B] = genLFunc(a1, an, EspMatrix_B, qM_B, dM_B);
a1=0;
an=100;
[EspMatrix_F, qM_F, dM_F, QDplusInd_F]= preCompQDMatrix(TM_F);
[aArrMax_F, qArrMax_F, dArrMax_F] = genLFunc(a1, an, EspMatrix_F, qM_F, dM_F);
%% alloc budget by upper bound
a=1;
[e]=allocEspByUpperBound(a, TM_B, TM_F);
eArr=ones(1,T)*e;
cprintf('blue', 'alloc budget by upper bound ')
printTPL=1;
plotTPL(eArr, TM_B, TM_F, printTPL);
%% alloc budget by quantification
a=1;
[e_s, e_mid, e_end]=allocEspByQuantify(a, TM_B, TM_F)
eArr_mid=ones(1, T-2)*e_mid;
eArr=[e_s, eArr_mid, e_end];
cprintf('blue', 'alloc budget by quantification ')
printTPL=1;
plotTPL(eArr, TM_B, TM_F, printTPL);