Pareto Rank Distribution (distr_Par)

import math

from pyxla import distr_Par
from pyxla.util import load_data
from pyxla.sampling import HilbertCurveSampler
from matplotlib import rc_file
rc_file('../../../../src/.matplotlibrc')
sphere_sample = {
    "name": "Sphere",
    "X": HilbertCurveSampler(sample_size=100, dim=1, l_bound=-5, u_bound=5, seed=42),
    "F": lambda x: x**2,
    "V": [lambda x: x**2 - 2, lambda x: 8 * math.sin(20 * x)]
}

deceptive_sample = {
    "name": "Deceptive",
    "X": HilbertCurveSampler(sample_size=100, dim=1, l_bound=0, u_bound=6),
    "F": lambda x: (0.4 * x - 2) ** 2 if x > 0.625 else (10 * x - 4) ** 2 - 2,
    "V": lambda x: ((0.4 * x - 2) ** 2 if x > 0.625 else (10 * x - 4) ** 2 - 2) - 1
}

load_data(sphere_sample)
load_data(deceptive_sample)
feat, plot = distr_Par(sphere_sample, title=False)
plot.savefig('distr-Par-sphere.pdf', bbox_inches='tight')
feat, plot = distr_Par(deceptive_sample, title=False)
plot.savefig('distr-Par-deceptive.pdf', bbox_inches='tight')