(self, x, pen_fac = 1e4)
return f if len(f) > 1 else f[0]
multimodal Schwefel function with domain -500..500
multimodal Schwefel function with domain -500..500
multimodal Schwefel function with domain - 500 .. 500
def schwefelmult(self, x, pen_fac = 1e4):
        """multimodal Schwefel function with domain -500..500"""
        y = [x] if np.isscalar(x[0]) else x
        N = len(y[0])
        f = array([418.9829*N - 1.27275661e-5*N - sum(x * np.sin(np.abs(x)**0.5))
                + pen_fac * sum((abs(x) > 500) * (abs(x) - 500)**2) for x in y])
        return f if len(f) > 1 else f[0]
def schwefelmult ( self , x , pen_fac = 1e4 ) : y = [ x ] if np . isscalar ( x [ 0 ] ) else x N = len ( y [ 0 ] ) f = array ( [ 418.9829 * N - 1.27275661e-5 * N - sum ( x * np . sin ( np . abs ( x ) ** 0.5 ) ) + pen_fac * sum ( ( abs ( x ) > 500 ) * ( abs ( x ) - 500 ) ** 2 ) for x in y ] ) return f if len ( f ) > 1 else f [ 0 ]