(self, x)
return f
Sphere (squared norm) test objective function
Sphere (squared norm) test objective function
Sphere ( squared norm ) test objective function
def partsphere(self, x):
        """Sphere (squared norm) test objective function"""
        self.counter += 1
        # return np.random.rand(1)[0]**0 * sum(x**2) + 1 * np.random.rand(1)[0]
        dim = len(x)
        x = array([x[i % dim] for i in range(2*dim)])
        N = 8
        i = self.counter % dim
        #f = sum(x[i:i + N]**2)
        f = sum(x[np.random.randint(dim, size=N)]**2)
        return f
def partsphere ( self , x ) : self . counter += 1 # return np.random.rand(1)[0]**0 * sum(x**2) + 1 * np.random.rand(1)[0] dim = len ( x ) x = array ( [ x [ i % dim ] for i in range ( 2 * dim ) ] ) N = 8 i = self . counter % dim #f = sum(x[i:i + N]**2) f = sum ( x [ np . random . randint ( dim , size = N ) ] ** 2 ) return f