-
-
Notifications
You must be signed in to change notification settings - Fork 152
/
experimenter_plot.py
43 lines (35 loc) · 1.52 KB
/
experimenter_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
36
37
38
39
40
41
42
43
import matplotlib.pyplot as plt
from platypus import (CMAES, DTLZ2, GDE3, IBEA, MOEAD, NSGAII, NSGAIII, OMOPSO,
SMPSO, SPEA2, EpsMOEA, ProcessPoolEvaluator, experiment,
normal_boundary_weights)
if __name__ == '__main__':
# setup the experiment
problem = DTLZ2(3)
algorithms = [NSGAII,
(NSGAIII, {"divisions_outer": 12}),
(CMAES, {"epsilons": [0.05]}),
GDE3,
IBEA,
(MOEAD, {"weight_generator": normal_boundary_weights, "divisions_outer": 12}),
(OMOPSO, {"epsilons": [0.05]}),
SMPSO,
SPEA2,
(EpsMOEA, {"epsilons": [0.05]})]
# run the experiment using Python 3's concurrent futures for parallel evaluation
with ProcessPoolEvaluator() as evaluator:
results = experiment(algorithms, problem, seeds=1, nfe=10000, evaluator=evaluator)
# display the results
fig = plt.figure()
for i, algorithm in enumerate(results.keys()):
result = results[algorithm]["DTLZ2"][0]
ax = fig.add_subplot(2, 5, i+1, projection='3d')
ax.scatter([s.objectives[0] for s in result],
[s.objectives[1] for s in result],
[s.objectives[2] for s in result])
ax.set_title(algorithm)
ax.set_xlim([0, 1.1])
ax.set_ylim([0, 1.1])
ax.set_zlim([0, 1.1])
ax.view_init(elev=30.0, azim=15.0)
ax.locator_params(nbins=4)
plt.show()