original_docstring: 
      Alternative Version of Two-Point crossover
      
docstring: Alternative Version of Two-Point crossover
docstring_tokens: Alternative Version of Two - Point crossover
code: def two_point_crossover3(p):
      """
      Alternative Version of Two-Point crossover
      """
      n = p.shape[2]
      swath = np.random.randint(1, n)
      cut1 = np.random.randint(0, n - swath)
      cut2 = cut1 + swath
      ps0 = p.shape[0]
  
      off = np.zeros((ps0, n))
      sel = p[:, 0, cut1:cut2]
      off[:, cut1:cut2] = sel
      p1 = p[:, 1]
  
      result = np.empty_like(p1)
      for i in range(ps0):
          result[i] = ~np.isin(p1[i], sel[i])
      result = result.astype(bool)
  
      sel = np.array(np.split(p1[result], ps0))
  
      off[:, 0:cut1] = sel[:, 0:cut1]
      off[:, cut2:] = sel[:, cut1:]
      return off
code_tokens: def two_point_crossover3 ( p ) : n = p . shape [ 2 ] swath = np . random . randint ( 1 , n ) cut1 = np . random . randint ( 0 , n - swath ) cut2 = cut1 + swath ps0 = p . shape [ 0 ] off = np . zeros ( ( ps0 , n ) ) sel = p [ : , 0 , cut1 : cut2 ] off [ : , cut1 : cut2 ] = sel p1 = p [ : , 1 ] result = np . empty_like ( p1 ) for i in range ( ps0 ) : result [ i ] = ~ np . isin ( p1 [ i ] , sel [ i ] ) result = result . astype ( bool ) sel = np . array ( np . split ( p1 [ result ] , ps0 ) ) off [ : , 0 : cut1 ] = sel [ : , 0 : cut1 ] off [ : , cut2 : ] = sel [ : , cut1 : ] return off
short_docstring: Alternative Version of Two-Point crossover
short_docstring_tokens: Alternative Version of Two - Point crossover
comment: """
      Alternative Version of Two-Point crossover
      """