import functools
from platypus import MOEAD, DTLZ2, pbi

# define the problem definition
problem = DTLZ2()

# instantiate the optimization algorithm
algorithm = MOEAD(problem, scalarizing_function=functools.partial(pbi, theta=20))

# optimize the problem using 10,000 function evaluations
algorithm.run(10000)

# plot the results using matplotlib
import matplotlib.pyplot as plt

plt.scatter([s.objectives[0] for s in algorithm.result],
            [s.objectives[1] for s in algorithm.result])
plt.xlim([0, 1.1])
plt.ylim([0, 1.1])
plt.xlabel("$f_1(x)$")
plt.ylabel("$f_2(x)$")
plt.show()