forked from bicep/RBFMOpt-Benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark_plot.py
35 lines (26 loc) · 1.33 KB
/
benchmark_plot.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
import matplotlib.pyplot as plt
from utils.utils import plot_spline, load_values
n = 10
max_fevals = 100 # (dim+1) * 100
fevals_plot = range(0, max_fevals)
# For the 7 dtlz problems
for i in range(7):
hv_rbfmopt_plot = load_values('storedvalues/rbfmopt_hv_' + 'dtlz' + str(i+1) + '_fevals' + str(max_fevals) + '.txt')
hv_moead_plot = load_values('storedvalues/moead_hv_' + 'dtlz' + str(i+1) + '_fevals' + str(max_fevals) + '.txt')
hv_nsga2_plot = load_values('storedvalues/nsga2_hv_' + 'dtlz' + str(i+1) + '_fevals' + str(max_fevals) + '.txt')
fig, ax = plt.subplots()
plot_spline(plt, fevals_plot, hv_rbfmopt_plot, max_fevals, "rbfmopt")
plot_spline(plt, fevals_plot, hv_moead_plot, max_fevals, "moead")
plot_spline(plt, fevals_plot, hv_nsga2_plot, max_fevals, "nsga2")
plt.legend(loc='best')
plt.title('DTLZ' + str(i+1))
plt.xlabel('Function evaluations')
plt.ylabel('Mean hypervolume over '+str(n)+' runs')
plt.grid()
plt.savefig('/Users/rogerko/dev/Opossum/benchmark/graphics/Graph_DTLZ' + str(i+1) + '.png')
plt.clf()
data = [hv_rbfmopt_plot, hv_moead_plot, hv_nsga2_plot]
plt.title('DTLZ' + str(i+1))
plt.boxplot(data)
plt.xticks([1, 2, 3], ['RBFMopt', 'MOEAD', 'NSGAII'])
plt.savefig('/Users/rogerko/dev/Opossum/benchmark/graphics/Boxplot_DTLZ' + str(i+1) + '.png')