-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_reselect.py
More file actions
61 lines (46 loc) · 1.5 KB
/
plot_reselect.py
File metadata and controls
61 lines (46 loc) · 1.5 KB
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
import matplotlib.pyplot as plt
# Read the data from the file
data = []
with open("reselect_10.txt", "r") as file:
for line in file:
x, y = line.strip().split(",")
data.append((float(x), float(y)))
# Extract x and y values
x_values = [x for x, _ in data]
y_values = [y for _, y in data]
# Create the plot
plt.plot(x_values, y_values, label="Total servers: 10, Threshold: 6")
data = []
with open("reselect_15.txt", "r") as file:
for line in file:
x, y = line.strip().split(",")
data.append((float(x), float(y)))
# Extract x and y values
x_values = [x for x, _ in data]
y_values = [y for _, y in data]
# Create the plot
plt.plot(x_values, y_values, label="Total servers: 15, Threshold: 8")
data = []
with open("reselect_20.txt", "r") as file:
for line in file:
x, y = line.strip().split(",")
data.append((float(x), float(y)))
# Extract x and y values
x_values = [x for x, _ in data]
y_values = [y for _, y in data]
# Create the plot
plt.plot(x_values, y_values, label="Total servers: 20, Threshold: 11")
data = []
with open("reselect_30.txt", "r") as file:
for line in file:
x, y = line.strip().split(",")
data.append((float(x), float(y)))
# Extract x and y values
x_values = [x for x, _ in data]
y_values = [y for _, y in data]
# Create the plot
plt.plot(x_values, y_values, label="Total servers: 30, Threshold: 16")
# plt.xlabel("malicious probability")
# plt.ylabel("average number of reselections")
plt.legend()
plt.savefig("reselect.pdf")