|
| 1 | +import csv |
| 2 | +import sys |
| 3 | + |
| 4 | +csvfile1=open(sys.argv[1], 'r') |
| 5 | +reader1 = list(csv.reader(csvfile1, delimiter=',')) |
| 6 | + |
| 7 | +csvfile2=open(sys.argv[2], 'r') |
| 8 | +reader2 = list(csv.reader(csvfile2, delimiter=',')) |
| 9 | + |
| 10 | +csvfile3=open(sys.argv[3], 'r') |
| 11 | +reader3 = list(csv.reader(csvfile3, delimiter=',')) |
| 12 | + |
| 13 | +csvfile4=open(sys.argv[4], 'r') |
| 14 | +reader4 = list(csv.reader(csvfile4, delimiter=',')) |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +prakhargenetic = 0.0 |
| 19 | +ronakgenetic = 0.0 |
| 20 | +bestrandomls = 0.0 |
| 21 | +worstrandomls = 0.0 |
| 22 | +topologicalls = 0.0 |
| 23 | +swapsearch = 0.0 |
| 24 | + |
| 25 | +num = 15 # there are 180 task graphs |
| 26 | + |
| 27 | +pg = [] |
| 28 | +rg = [] |
| 29 | +brls = [] |
| 30 | +wrls = [] |
| 31 | +tls = [] |
| 32 | +ss = [] |
| 33 | + |
| 34 | +for i in range(num): |
| 35 | + opt=int(reader2[i][0]) |
| 36 | + |
| 37 | + t=((int(reader1[i][0])-opt)*100)/opt |
| 38 | + prakhargenetic+=t |
| 39 | + t=round(t,2) |
| 40 | + pg.append(t) |
| 41 | + |
| 42 | + t=((int(reader2[i][0])-opt)*100)/opt |
| 43 | + ronakgenetic+=t |
| 44 | + t=round(t,2) |
| 45 | + rg.append(t) |
| 46 | + |
| 47 | + t=((int(reader3[i][0])-opt)*100)/opt |
| 48 | + bestrandomls+=t |
| 49 | + t=round(t,2) |
| 50 | + brls.append(t) |
| 51 | + |
| 52 | + t=((int(reader3[i][1])-opt)*100)/opt |
| 53 | + worstrandomls+=t |
| 54 | + t=round(t,2) |
| 55 | + wrls.append(t) |
| 56 | + |
| 57 | + t=((int(reader3[i][2])-opt)*100)/opt |
| 58 | + topologicalls+=t |
| 59 | + t=round(t,2) |
| 60 | + tls.append(t) |
| 61 | + |
| 62 | + t=((int(reader4[i][0])-opt)*100)/opt |
| 63 | + swapsearch+=t |
| 64 | + t=round(t,2) |
| 65 | + ss.append(t) |
| 66 | + |
| 67 | +prakhargenetic/=num |
| 68 | +ronakgenetic/=num |
| 69 | +bestrandomls/=num |
| 70 | +worstrandomls/=num |
| 71 | +topologicalls/=num |
| 72 | +swapsearch/=num |
| 73 | + |
| 74 | +prakhargenetic=round(prakhargenetic,2) |
| 75 | +ronakgenetic=round(ronakgenetic,2) |
| 76 | +bestrandomls=round(bestrandomls,2) |
| 77 | +worstrandomls=round(worstrandomls,2) |
| 78 | +topologicalls=round(topologicalls,2) |
| 79 | +swapsearch=round(swapsearch,2) |
| 80 | + |
| 81 | +pg.sort() |
| 82 | +rg.sort() |
| 83 | +brls.sort() |
| 84 | +wrls.sort() |
| 85 | +tls.sort() |
| 86 | +ss.sort() |
| 87 | + |
| 88 | +showavg=1 |
| 89 | +showmin=0 |
| 90 | +showmax=0 |
| 91 | +sp=" " |
| 92 | + |
| 93 | +if showavg: |
| 94 | + sys.stdout.write("prakhargenetic= "+str(prakhargenetic)+"%") |
| 95 | +if showmin: |
| 96 | + sys.stdout.write(sp+str(pg[0])+"%") |
| 97 | +if showmax: |
| 98 | + sys.stdout.write(sp+str(pg[num-1])+"%") |
| 99 | +print() |
| 100 | + |
| 101 | +if showavg: |
| 102 | + sys.stdout.write("ronakgenetic= "+str(ronakgenetic)+"%") |
| 103 | +if showmin: |
| 104 | + sys.stdout.write(sp+str(rg[0])+"%") |
| 105 | +if showmax: |
| 106 | + sys.stdout.write(sp+str(rg[num-1])+"%") |
| 107 | +print() |
| 108 | + |
| 109 | +if showavg: |
| 110 | + sys.stdout.write("bestrandomls= "+str(bestrandomls)+"%") |
| 111 | +if showmin: |
| 112 | + sys.stdout.write(sp+str(brls[0])+"%") |
| 113 | +if showmax: |
| 114 | + sys.stdout.write(sp+str(brls[num-1])+"%") |
| 115 | +print() |
| 116 | + |
| 117 | +if showavg: |
| 118 | + sys.stdout.write("worstrandomls= "+str(worstrandomls)+"%") |
| 119 | +if showmin: |
| 120 | + sys.stdout.write(sp+str(wrls[0])+"%") |
| 121 | +if showmax: |
| 122 | + sys.stdout.write(sp+str(wrls[num-1])+"%") |
| 123 | +print() |
| 124 | + |
| 125 | +if showavg: |
| 126 | + sys.stdout.write("topologicalls= "+str(topologicalls)+"%") |
| 127 | +if showmin: |
| 128 | + sys.stdout.write(sp+str(tls[0])+"%") |
| 129 | +if showmax: |
| 130 | + sys.stdout.write(sp+str(tls[num-1])+"%") |
| 131 | +print() |
| 132 | + |
| 133 | +if showavg: |
| 134 | + sys.stdout.write("swapsearch= "+str(swapsearch)+"%") |
| 135 | +if showmin: |
| 136 | + sys.stdout.write(sp+str(ss[0])+"%") |
| 137 | +if showmax: |
| 138 | + sys.stdout.write(sp+str(ss[num-1])+"%") |
| 139 | +print() |
0 commit comments