(self, x)
return -0.01*x[0] + abs(x[0])**-2 * sum(x[1:]**2)
Sphere (squared norm) with sum x_i = 1 test objective function
Sphere (squared norm) with sum x_i = 1 test objective function
Sphere ( squared norm ) with sum x_i = 1 test objective function
def spherew(self, x):
        """Sphere (squared norm) with sum x_i = 1 test objective function"""
        # return np.random.rand(1)[0]**0 * sum(x**2) + 1 * np.random.rand(1)[0]
        # s = sum(abs(x))
        # return sum((x/s+0)**2) - 1/len(x)
        # return sum((x/s)**2) - 1/len(x)
        return -0.01*x[0] + abs(x[0])**-2 * sum(x[1:]**2)
def spherew ( self , x ) : # return np.random.rand(1)[0]**0 * sum(x**2) + 1 * np.random.rand(1)[0] # s = sum(abs(x)) # return sum((x/s+0)**2) - 1/len(x) # return sum((x/s)**2) - 1/len(x) return - 0.01 * x [ 0 ] + abs ( x [ 0 ] ) ** - 2 * sum ( x [ 1 : ] ** 2 )