-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprotocol_prophetMetricSetting2.m
101 lines (63 loc) · 3.36 KB
/
protocol_prophetMetricSetting2.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
%% Initializing Prophet Values
for temp_nodeIndex = 1:input_settings.MN_N
for intermeet_index = 1:input_settings.MN_N
MN_DATA_SOCIA_temp.VS_NODE(temp_nodeIndex).PROPHET(intermeet_index) = 0;
end
end
P_init = .75;
BETA = .25;
% Wait Bar
wait_bar = waitbar(0, 'Percentage Completed');
set(wait_bar, 'name', 'Setting Prophet Metrics (Stage 1)...');
wb = 100/length(1:input_settings.MN_N);
%%
ALL_NODES_INDICES = 1:input_settings.MN_N;
for MN_INDEX_1 = ALL_NODES_INDICES
SOME_NODES_INDICES = ALL_NODES_INDICES;
SOME_NODES_INDICES( SOME_NODES_INDICES == MN_INDEX_1 ) =[];
for MN_INDEX_2 = SOME_NODES_INDICES
intermeeting_times = [MN_DATA_SOCIA_temp.VS_NODE(MN_INDEX_1).SOCIAL_CONTACT(MN_INDEX_2).MEETING_TIME];
if length(intermeeting_times) <= 1
MN_DATA_SOCIA_temp.VS_NODE(MN_INDEX_1).PROPHET(MN_INDEX_2) = 0;
else
for intermeet_times_index = intermeeting_times
temp_probability_a_b = MN_DATA_SOCIA_temp.VS_NODE(MN_INDEX_1).PROPHET(MN_INDEX_2);
MN_DATA_SOCIA_temp.VS_NODE(MN_INDEX_1).PROPHET(MN_INDEX_2) = temp_probability_a_b + (1- temp_probability_a_b)*P_init;
end
end
end
str_bar = [num2str(wb) '% Completed'];
waitbar(wb/100, wait_bar, str_bar);
wb = wb + 100/length(1:input_settings.MN_N);
end
close(wait_bar); % Wait Bar
% Wait Bar
wait_bar = waitbar(0, 'Percentage Completed');
set(wait_bar, 'name', 'Setting Prophet Metrics (Stage 2)...');
wb = 100/length(1:input_settings.MN_N);
for MN_INDEX_1 = ALL_NODES_INDICES
SOME_NODES_INDICES = ALL_NODES_INDICES;
SOME_NODES_INDICES( SOME_NODES_INDICES == MN_INDEX_1 ) =[];
for MN_INDEX_2 = SOME_NODES_INDICES
MN_INDEX_1_prophet_intermeet_nodes = [MN_DATA_SOCIA_temp.VS_NODE(MN_INDEX_1).MEET_ID];
temp_probability_a_b = MN_DATA_SOCIA_temp.VS_NODE(MN_INDEX_1).PROPHET(MN_INDEX_2);
prophet_intermeet_nodes = [MN_DATA_SOCIA_temp.VS_NODE(MN_INDEX_2).MEET_ID];
prophet_intermeet_nodes( prophet_intermeet_nodes == MN_INDEX_1) = [];
for delivery_probabilities = prophet_intermeet_nodes
relay_intermeet_times = [MN_DATA_SOCIA_temp.VS_NODE(MN_INDEX_2).SOCIAL_CONTACT(delivery_probabilities).MEETING_TIME];
if (length(relay_intermeet_times)> 1) && isempty(find ( MN_INDEX_1_prophet_intermeet_nodes == delivery_probabilities, 1 ) )
temp_probability_a_c = MN_DATA_SOCIA_temp.VS_NODE(MN_INDEX_1).PROPHET(delivery_probabilities);
temp_b_c = MN_DATA_SOCIA_temp.VS_NODE(MN_INDEX_2).PROPHET(delivery_probabilities);
MN_DATA_SOCIA_temp.VS_NODE(MN_INDEX_1).PROPHET(delivery_probabilities) = ...
temp_probability_a_c + ( (1 - temp_probability_a_c)*temp_probability_a_b*temp_b_c*BETA );
% else
% MN_DATA_SOCIA_temp.VS_NODE(MN_INDEX_1).PROPHET(delivery_probabilities) = 0;
end
end
end
str_bar = [num2str(wb) '% Completed'];
waitbar(wb/100, wait_bar, str_bar);
wb = wb + 100/length(1:input_settings.MN_N);
end
close(wait_bar); % Wait Bar
clear MN_INDEX_1 MN_INDEX_2 routing_time_index