-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDeprecated_Plot_DifferentEdgeNumToNodeNumRation_finishtime.m
104 lines (73 loc) · 2.95 KB
/
Deprecated_Plot_DifferentEdgeNumToNodeNumRation_finishtime.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
%Plot_DifferentEdgeNumToNodeNumRation_finishtime
%给一个时间阈值
threshold = 0;%时间阈值根据跑出来的结果中,耗时最长的任务来决定
Tasknum = 35;
Servernum = 8;
userNum = 25;
% userNum = 1;
% Servernum = 5;
% %Tasknum = 30;
% Tasknum = 15;
Ration = [0,2,4,6,8,10,12];
len = length(Ration(:));
taskset = randperm(Tasknum,Tasknum);
y_a = zeros(1, len);
y2_a = zeros(1, len);
y3_a = zeros(1,len);
y4_a = zeros(1, len);
maxtime = 5;
for times = 1 : maxtime%注意!!!!这里做了重复试验,结果需要除以次数
[ServerMemory,TaskMemory,Possionrate,Transferrate,Transferrate_network,Computespeed_Local,ComputeSpeed_server,EdgeWeight,TaskSize] = GenerateData_NetworkConnect(round(Servernum*(Servernum-1)/4),userNum,Servernum,Tasknum);
for k=1:len
Graph = GenarateGraph_DifferentEdgeNum(Tasknum,Tasknum * Ration(k));
[Taskgraph,Graph] = GenarateGraphCommon_2(Graph,Tasknum,userNum,0.3); %相似任务占比0.3
Taskgraph = FulFillTaskgraph(Taskgraph,EdgeWeight,TaskSize,userNum,Tasknum);
[~,~,~, taskFinishTime_best] = P1_IterateNum_network_addFinishtime(10000, Tasknum,userNum,Servernum,ServerMemory,TaskMemory,Possionrate,Taskgraph,Transferrate,Transferrate_network,Computespeed_Local,ComputeSpeed_server);
%动态更新threshold时间阈值
if k==1
threshold = max(taskFinishTime_best);
end
count4 = 0;
for index = 1:userNum
if taskFinishTime_best(index) <= threshold
count4 = count4 + 1;
end
end
y4_a(k) = y4_a(k)+count4;
[~,~,~, taskFinishTime_p3] = P3_network_addFinishtime(Tasknum,userNum,Servernum,ServerMemory,TaskMemory,Possionrate,Taskgraph,Transferrate,Transferrate_network,Computespeed_Local,ComputeSpeed_server);
count = 0;
for index = 1:userNum
if taskFinishTime_p3(index) <= threshold
count = count + 1;
end
end
y_a(k) = y_a(k)+ count;
[~,~,~, taskFinishTime_iwqos2] = P1_iwqos_network_taskset_addFinishtime(taskset,Tasknum,userNum,Servernum,ServerMemory,TaskMemory,Possionrate,Taskgraph,Transferrate,Transferrate_network,Computespeed_Local,ComputeSpeed_server);
count3 = 0;
for index = 1:userNum
if taskFinishTime_iwqos2(index) <= threshold
count3 = count3 + 1;
end
end
y3_a(k) = y3_a(k) + count3;
[~,~,~, taskFinishTime_infocom] = P1_infocom_network_addFinishtime(Tasknum,userNum,Servernum,ServerMemory,TaskMemory,Possionrate,Taskgraph,Transferrate,Transferrate_network,Computespeed_Local,ComputeSpeed_server);
count2 = 0;
for index = 1:userNum
if taskFinishTime_infocom(index) <= threshold
count2 = count2 + 1;
end
end
y2_a(k) = y2_a(k)+count2;
end
times
end
%由于做了maxtimes组重复试验,结果需要除以maxtimes
y_a = y_a/maxtime;
y2_a = y2_a/maxtime;
y3_a = y3_a/maxtime;
y4_a = y4_a/maxtime;
hold on;
plot(Ration, y4_a);
plot(Ration, y_a);
plot(Ration, y2_a);
plot(Ration, y3_a);