-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmooth.py
More file actions
36 lines (30 loc) · 881 Bytes
/
Copy pathsmooth.py
File metadata and controls
36 lines (30 loc) · 881 Bytes
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
import numpy as np
import matplotlib.pyplot as plt
makespans = []
f_path = "makespan/v=" + str(20) + "n=" + str(34) + "/"
filename = f_path + "makespan.txt"
with open(filename, 'r') as file_object:
lines = file_object.readlines()
# print(len(lines))
heft = int(lines[0])
# print(heft)
for i in range(1, len(lines)):
makespan = int(lines[i])
makespans.append(makespan)
sp = makespans
N = 35
n = np.ones(N)
weights = n / N
sma = np.convolve(weights, sp)[N-1:-N+1]
t = np.arange(N-1, len(sp))
# plot(t,sp[N-1:],lw=1)
# plot.axhline(heft, linewidth=0.5, color='r')
plt.axhline(heft, linewidth=1.5, color='r', label="HEFT")
plt.xlabel("Episode", fontsize=12)
plt.ylabel("- Makespan", fontsize=12)
plt.xticks(fontsize=12)
plt.yticks(fontsize=12)
plt.plot(t, sma, color='b', label="ADTS")
plt.legend(loc='best')
# plt.ylim(-325, -125)
plt.show()