def f06_attractive_sector(x, xopt, fopt, Q, R, L, D): z = Q @ L @ R @ (x - xopt) s = np.full((D, ), 1) s[z * xopt > 0] = 100 val = np.power(T_osz(np.sum(np.power(s * z, 2))), 0.9) + fopt return FitObjPair(fitness=-val, objective=val - fopt)
def f01_sphere(x, xopt, fopt): z = x - xopt val = np.linalg.norm(z)**2 + fopt return FitObjPair(fitness=-val, objective=val - fopt)
def f02_ellipsoidal(x, xopt, fopt, D, i): z = T_osz(x - xopt) val = np.sum(np.power(np.full(D, 10), i / (D - 1)) * z * z) + fopt return FitObjPair(fitness=-val, objective=val - fopt)
def f08_rosenbrock(x, xopt, fopt, D): z = np.max((1, np.sqrt(D) / 8)) * (x - xopt) + 1 val = np.sum( np.power(np.power(z[:-1], 2) - z[1:], 2) + np.power(z[:-1] - 1, 2)) + fopt return FitObjPair(fitness=-val, objective=val - fopt)