code: def cxTwoPointCopy(ind1, ind2):
      """Execute a two points crossover with copy on the input individuals. The
      copy is required because the slicing in numpy returns a view of the data,
      which leads to a self overwriting in the swap operation. It prevents
      ::
  
          >>> import numpy
          >>> a = numpy.array((1,2,3,4))
          >>> b = numpy.array((5,6,7,8))
          >>> a[1:3], b[1:3] = b[1:3], a[1:3]
          >>> print(a)
          [1 6 7 4]
          >>> print(b)
          [5 6 7 8]
      """
      size = len(ind1)
      cxpoint1 = random.randint(1, size)
      cxpoint2 = random.randint(1, size - 1)
      if cxpoint2 >= cxpoint1:
          cxpoint2 += 1
      else:  # Swap the two cx points
          cxpoint1, cxpoint2 = cxpoint2, cxpoint1
  
      ind1[cxpoint1:cxpoint2], ind2[cxpoint1:cxpoint2] = (
          ind2[cxpoint1:cxpoint2].copy(),
          ind1[cxpoint1:cxpoint2].copy(),
      )
  
      return ind1, ind2
  
file_path: deap/examples/ga/onemax_numpy.py
imports: import random
  import numpy
  from deap import algorithms
  from deap import base
  from deap import creator
  from deap import tools
label_desc: Use image node_id 2 for calling a global function with example usage: cxTwoPointCopy(ind1, ind2) and returns: ind1,  ind2