-
Notifications
You must be signed in to change notification settings - Fork 0
/
experiment_varying_umax.m
78 lines (63 loc) · 2.2 KB
/
experiment_varying_umax.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
function experiment_varying_umax(UmaxMin, UmaxMax, UmaxStep, Pi, mDelta, U, Tratio, casesNo, scheduler, hwType)
fileName = 'output/varying_Umax.txt';
GmprOPSolver = 'active-set';
warning('query', 'all');
warning('off','all');
caseItr = 1;
while caseItr <= casesNo
tasks = generate_taskset(U, UmaxMax, Tratio);
disp(['case no: ' int2str(caseItr)]);
valid = 1;
for Umax = UmaxMax:-UmaxStep:UmaxMin
tasks = update_taskset_for_new_Umax(tasks, Umax, Tratio);
mMin = compute_m(tasks, scheduler);
m = mMin + mDelta;
try
tic
gmpr = compute_gmpr(tasks, m, Pi, scheduler, GmprOPSolver);
timeGmpr = toc;
Ugmpr = (gmpr.thetas(end))/Pi;
%disp(['Ugmpr: ' num2str(Ugmpr)]);
tic
mpr = compute_mpr(tasks, m, Pi, scheduler);
timeMpr = toc;
Umpr = (mpr.theta)/Pi;
%disp(['Umpr: ' num2str(Umpr)]);
GainGmprMpr = round((Umpr - Ugmpr)*10000/Ugmpr)/100;
if GainGmprMpr < 0
disp('error due to OP solver');
%valid = 0;
%break;
continue;
end
disp(['Umax: ' num2str(Umax) ' n: ' int2str(numel(tasks)) ' m: ' int2str(m) ' gain GMPR vs MPR: ' num2str(GainGmprMpr)]);
catch
disp('problem occured! regenerating task set...');
%valid = 0;
%break;
continue;
end
results(1) = U;
results(2) = Umax;
results(3) = Tratio;
results(4) = numel(tasks);
results(5) = m;
results(6) = mDelta;
results(7) = Pi;
results(8) = Ugmpr;
results(9) = Umpr;
results(10) = timeGmpr;
results(11) = timeMpr;
results(12) = hwType;
if strcmpi(scheduler, 'gedf')
results(13) = 1;
elseif strcmpi(scheduler, 'gfp')
results(13) = 2;
end
dlmwrite(fileName, results, '-append', 'delimiter', ' ', 'precision', 6, 'newline', 'pc');
end % for UmaxItr
if valid == 1
caseItr = caseItr + 1;
end
end % while caseItr
end