-
Notifications
You must be signed in to change notification settings - Fork 3
/
CalculateReward.m
59 lines (54 loc) · 1.29 KB
/
CalculateReward.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
function Reward = CalculateReward(SINR, CurrentAction, NumBands)
Reward = 0;
% switch State(4)
% case 1
% Reward = Reward - 25;
% case 2
% Reward = Reward + 1;
% case 3
% Reward = Reward + 2;
% case 4
% Reward = Reward + 3;
% case 5
% Reward = Reward + 4;
% case 6
% Reward = Reward + 6;
% case 7
% Reward = Reward + 8;
% case 8
% Reward = Reward + 10;
% end
NegSINRPenalty = -10*(NumBands - 1) -5;
if SINR <= 0
% Reward = Reward - 35; % Delete this line
Reward = Reward + NegSINRPenalty;
elseif (SINR > 0) && (SINR < 2)
Reward = Reward + 1;
elseif (SINR >= 2) && (SINR < 5)
Reward = Reward + 2;
elseif (SINR >= 5) && (SINR < 8)
Reward = Reward + 3;
elseif (SINR >= 8) && (SINR < 11)
Reward = Reward + 4;
elseif (SINR >= 11) && (SINR < 14)
Reward = Reward + 5;
elseif (SINR >= 14) && (SINR < 17)
Reward = Reward + 6;
elseif (SINR >= 17) && (SINR < 20)
Reward = Reward + 8;
elseif SINR >= 20
Reward = Reward + 10;
end
tmp = sum(CurrentAction);
% switch tmp
% case 1
% Reward = Reward;
% case 2
% Reward = Reward + 10;
% case 3
% Reward = Reward + 20;
% case 4
% Reward = Reward + 30;
% end
Reward = Reward + 10*(tmp-1);
end