-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotter.py
More file actions
23 lines (19 loc) · 954 Bytes
/
Copy pathplotter.py
File metadata and controls
23 lines (19 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
sns.set_theme()
sns.set_style("whitegrid")
data16 = pd.read_csv('Solutions_one_run/solutions_file_16.csv', sep=',')
data32 = pd.read_csv('Solutions_one_run/solutions_file_32.csv', sep=",")
data64 = pd.read_csv('Solutions_one_run/solutions_file_64.csv', sep=",")
data128 = pd.read_csv('Solutions_one_run/solutions_file_128.csv', sep=",")
data256 = pd.read_csv('Solutions_one_run/solutions_file_256.csv', sep=",")
data_list = [data16, data32, data64, data128, data256]
for data in data_list:
gaps = [round(100*(val - opt)/opt, 2) if opt != 0 else 0
for (opt, val) in zip(data['optimal solution'], data['final cost'])]
data.insert(7, "gaps", gaps)
size = [''.join(s for s in filename if s.isdigit()) for filename in data['filename']]
data.insert(8, 'size', size)
sns.catplot(data=data, x='ansatz', y='gaps', hue='m', kind='bar')
plt.show()