'Rastrigin test objective function'

def rastrigin(self, x):

    if (not np.isscalar(x[0])):
        N = len(x[0])
        return [((10 * N) + sum(((xi ** 2) - (10 * np.cos(((2 * np.pi) * xi)))))) for xi in x]
    N = len(x)
    return ((10 * N) + sum(((x ** 2) - (10 * np.cos(((2 * np.pi) * x))))))
