-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
118 lines (105 loc) · 7.6 KB
/
main.py
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import pandas as pd
from copy import deepcopy
from time import process_time
from generator import generateInstances
import diagrams
from strategies.LMR import LMR
from strategies.HMR import HMR
from strategies.LPT import LPT
from strategies.RND import RND
from strategies.ALFA import ALFA
from strategies.BETA import BETA
df = pd.read_csv('zapat.csv', sep=';')
df = df[(df['Memory requirement (KB per CPU)'] > 0) & (df['Memory requirement (KB per CPU)'] <= 140509184) & (df['Processing time (s)'] > 0)]
NUM_OF_INSTANCES = 30
NUM_OF_MACHINES = 16
NUM_OF_SAMPLE = 5000
instances = generateInstances(df, NUM_OF_INSTANCES, NUM_OF_MACHINES, NUM_OF_SAMPLE)
DATA = {
'HMR': {
'CZAS': [],
'CMAX': []
},
'LMR': {
'CZAS': [],
'CMAX': [],
},
'LPT': {
'CZAS': [],
'CMAX': [],
},
'RND': {
'CZAS': [],
'CMAX': [],
},
'ALFA': {
'CZAS': [],
'CMAX': [],
},
'BETA': {
'CZAS': [],
'CMAX': [],
},
}
n = 0
t1_start = process_time()
for instance in instances:
start = process_time()
i = HMR(instance)
end = process_time()
DATA['HMR']['CZAS'].append(end - start)
DATA['HMR']['CMAX'].append(i.cmax() / instance.bound())
n += 1
print(n)
start = process_time()
i = LMR(instance)
end = process_time()
DATA['LMR']['CZAS'].append(end - start)
DATA['LMR']['CMAX'].append(i.cmax() / instance.bound())
n += 1
print(n)
start = process_time()
i = LPT(instance)
end = process_time()
DATA['LPT']['CZAS'].append(end - start)
DATA['LPT']['CMAX'].append(i.cmax() / instance.bound())
n += 1
print(n)
start = process_time()
i = RND(instance)
end = process_time()
DATA['RND']['CZAS'].append(end - start)
DATA['RND']['CMAX'].append(i.cmax() / instance.bound())
n += 1
print(n)
start = process_time()
i = ALFA(instance)
end = process_time()
DATA['ALFA']['CZAS'].append(end - start)
DATA['ALFA']['CMAX'].append(i.cmax() / instance.bound())
n += 1
print(n)
start = process_time()
i = BETA(instance)
end = process_time()
DATA['BETA']['CZAS'].append(end - start)
DATA['BETA']['CMAX'].append(i.cmax() / instance.bound())
n += 1
print(n)
print(DATA)
diagrams.generateBoxPlot({
'HMR': [1.0477002786519152, 1.038722873404183, 1.0543608262679713, 1.0373889613982725, 1.121895818458847, 1.0487368915700894, 1.0482122623374077, 1.0258236357373465, 1.0332064713505922, 1.0316733118907564, 1.0220045217093876, 1.1407941536342543, 1.032209414779751, 1.1584089638136683, 1.0311189025345684, 1.0564064717134785, 1.0503303489688887, 1.0391658162753772, 1.0339362046483267, 1.0191423068171956, 1.0532782150630773, 1.0275811683343876, 1.0473507169663194, 1.0222719237058095, 1.0774119035029661, 1.0508234561078027, 1.0409330889582813, 1.0267443471140054, 1.0202809240751323, 1.041863606908513],
'LMR': [1.4439894137322764, 1.423893838092557, 1.3952428509092538, 1.4179988258823557, 1.4051955838570132, 1.3972155131799362, 1.4535841201000808, 1.4089636440873141, 1.4462496196671522, 1.40867974063101, 1.5001002302037925, 1.3770690936468735, 1.4581211739555484, 1.441992689016243, 1.4245626706394945, 1.4396145108692262, 1.399662161125692, 1.3703960994103952, 1.4075774591412513, 1.4127906767627334, 1.4064989585516234, 1.4226827721124242, 1.3978589340428849, 1.405133810724373, 1.4548007171117237, 1.465165994675607, 1.4377809376186834, 1.4005896698031293, 1.421603797790692, 1.4897657160586695],
'LPT': [1.1384439760940803, 1.074377423138026, 1.0914629375907825, 1.0810122826327169, 1.1495491635178932, 1.1153583769337672, 1.1037745909112802, 1.1254831385653459, 1.1095032998919654, 1.1281781270009115, 1.1568167191573062, 1.0941518375209465, 1.1733081517626722, 1.1065257979555143, 1.0821139671946598, 1.1381681021877461, 1.128777843912698, 1.102515869051588, 1.1230912754054592, 1.1448113354286686, 1.1604686014584913, 1.1386063765427115, 1.1453305342476885, 1.1160856857571548, 1.1398626271117858, 1.1173330295822432, 1.1256773011031342, 1.1192834364561552, 1.1230747281757079, 1.118106640707254],
'RND': [1.1263093811046072, 1.0888100772220444, 1.1543082314914128, 1.1394268818796065, 1.18795687667532, 1.1408644236233645, 1.1308852174226083, 1.137696159685753, 1.1481951841551883, 1.1541199868922485, 1.1222139801100097, 1.1356811200125585, 1.1646838160373612, 1.1510211793493579, 1.093750610253441, 1.1440355542575262, 1.1677459211189147, 1.1110690141839996, 1.1595173597744146, 1.1583254023888574, 1.1520893761591844, 1.124944359402709, 1.1728953438558074, 1.1096376536822006, 1.159075166810714, 1.147479812667976, 1.1541657560002612, 1.1127649342717467, 1.1284547505235596, 1.2176520710388425],
'ALFA': [1.096511692292153, 1.0576219805873088, 1.0916355209610693, 1.0781705741049021, 1.1148244124971594, 1.0873442781465597, 1.0859631747856464, 1.0889275483326841, 1.077141573010674, 1.1137598512413436, 1.130472354095862, 1.0939899975713707, 1.1514927721917356, 1.0874496901946675, 1.0411118533346408, 1.1029780896877661, 1.0955350390624188, 1.0880957913608647, 1.0691621266312301, 1.131557504742843, 1.0895992345682683, 1.1168388479382796, 1.1088633748857553, 1.0969579638298452, 1.0806784653124126, 1.0573862177059978, 1.0751300624298603, 1.0562926401030526, 1.1107819005751827, 1.1117386213957083],
'BETA': [1.045124943319499, 1.0594445961634569, 1.063119992645649, 1.055467933554727, 1.0235653046354998, 1.049000832018456, 1.043601447476847, 1.0351868471853853, 1.0708190547087884, 1.0591846154853568, 1.05297084752814, 1.0773368586651033, 1.0711534570843886, 1.0992301616956242, 1.062968751044886, 1.169830407262968, 1.0339261397001454, 1.049634616587392, 1.040940991554657, 1.045116303939577, 1.0363620627073478, 1.0417111618102828, 1.0324434003679848, 1.050582633227579, 1.0512054609400614, 1.0440046305988537, 1.1185662400967218, 1.0500906434441082, 1.0419009926699967, 1.0618781520365983]
}, 'Maksymalny czasy zakończenia algorytmów', './charts/cmax.png')
diagrams.generateBoxPlot({
'HMR': [11.203125, 7.828125, 12.25, 9.140625, 10.703125, 14.90625, 12.875, 14.171875, 8.9375, 11.625, 9.640625, 12.75, 9.65625, 7.78125, 8.390625, 10.375, 11.015625, 12.84375, 13.21875, 10.78125, 12.625, 12.3125, 18.28125, 13.0625, 10.71875, 10.453125, 13.375, 14.140625, 9.28125, 9.109375],
'LMR': [3.609375, 4.703125, 3.75, 3.46875, 4.046875, 4.375, 4.140625, 3.796875, 3.5625, 3.921875, 3.421875, 3.640625, 3.765625, 3.65625, 4.5, 3.90625, 3.609375, 3.53125, 3.625, 4.0, 3.828125, 4.78125, 4.6875, 4.875, 3.671875, 4.03125, 4.0625, 3.59375, 3.765625, 4.3125],
'LPT': [4.453125, 4.8125, 5.125, 3.921875, 6.03125, 6.28125, 5.5, 5.15625, 5.25, 6.40625, 4.671875, 5.015625, 5.953125, 5.140625, 4.15625, 7.6875, 7.75, 5.21875, 6.734375, 5.46875, 4.921875, 7.3125, 6.109375, 5.265625, 4.71875, 5.046875, 4.421875, 4.546875, 6.15625, 4.65625],
'RND': [3.03125, 3.359375, 2.890625, 3.21875, 3.1875, 3.625, 3.296875, 3.578125, 3.109375, 3.0625, 2.953125, 3.265625, 3.21875, 3.515625, 4.125, 3.46875, 3.21875, 3.359375, 3.25, 3.078125, 3.5, 4.1875, 3.609375, 3.390625, 3.1875, 3.265625, 3.328125, 3.34375, 3.9375, 3.203125],
'ALFA': [6.734375, 3.65625, 5.640625, 5.3125, 8.828125, 6.578125, 4.53125, 5.953125, 5.8125, 5.046875, 3.40625, 8.703125, 9.8125, 8.46875, 5.640625, 8.59375, 6.0, 8.078125, 3.859375, 8.6875, 6.796875, 10.53125, 6.484375, 7.765625, 8.046875, 5.515625, 3.90625, 8.5625, 4.484375, 8.09375],
'BETA': [8.125, 4.640625, 7.484375, 6.40625, 12.796875, 6.953125, 11.90625, 7.328125, 5.828125, 6.046875, 6.453125, 7.859375, 6.421875, 6.59375, 7.046875, 6.9375, 7.9375, 9.046875, 11.59375, 6.4375, 8.6875, 7.59375, 13.953125, 8.0625, 6.296875, 6.9375, 6.703125, 7.453125, 7.09375, 6.390625],
}, 'Czasy wykonania algorytmów', './charts/times.png')