class_docstr: !
  @brief Class represents Genetic clustering algorithm.
  @details The searching capability of genetic algorithms is exploited in order to search for appropriate
           cluster centres.
  
  Example of clustering using genetic algorithm:
  @code
      from pyclustering.cluster.ga import genetic_algorithm, ga_observer
      from pyclustering.utils import read_sample
      from pyclustering.samples.definitions import SIMPLE_SAMPLES
  
  
      # Read input data for clustering
      sample = read_sample(SIMPLE_SAMPLES.SAMPLE_SIMPLE4)
  
      # Create instance of observer that will collect all information:
      observer_instance = ga_observer(True, True, True)
  
      # Create genetic algorithm for clustering
      ga_instance = genetic_algorithm(data=sample,
                                      count_clusters=4,
                                      chromosome_count=100,
                                      population_count=200,
                                      count_mutation_gens=1)
  
      # Start processing
      ga_instance.process()
  
      # Obtain results
      clusters = ga_instance.get_clusters()
  
      # Print cluster to console
      print("Amount of clusters: '%d'. Clusters: '%s'" % (len(clusters), clusters))
  @endcode
  
  There is an example of clustering results (fitness function evolution and allocated clusters) that were 
  visualized by 'ga_visualizer':
  
  @image html ga_clustering_sample_simple_04.png
  
  @see ga_visualizer
  @see ga_observer
class_docstr_tok: ["!","@","brief","Class","represents","Genetic","clustering","algorithm",".","@","details","The","searching","capability","of","genetic","algorithms","is","exploited","in","order","to","search","for","appropriate","cluster","centres",".","Example","of","clustering","using","genetic","algorithm",":","@","code","from","pyclustering.cluster.ga","import","genetic_algorithm",",","ga_observer","from","pyclustering.utils","import","read_sample","from","pyclustering.samples.definitions","import","SIMPLE_SAMPLES","#","Read","input","data","for","clustering","sample","=","read_sample","(","SIMPLE_SAMPLES.SAMPLE_SIMPLE4",")","#","Create","instance","of","observer","that","will","collect","all","information",":","observer_instance","=","ga_observer","(","True",",","True",",","True",")","#","Create","genetic","algorithm","for","clustering","ga_instance","=","genetic_algorithm","(","data=sample",",","count_clusters=4",",","chromosome_count=100",",","population_count=200",",","count_mutation_gens=1",")","#","Start","processing","ga_instance.process","(",")","#","Obtain","results","clusters","=","ga_instance.get_clusters","(",")","#","Print","cluster","to","console","print","(","``","Amount","of","clusters",":","'","%","d","'",".","Clusters",":","'","%","s","'","''","%","(","len","(","clusters",")",",","clusters",")",")","@","endcode","There","is","an","example","of","clustering","results","(","fitness","function","evolution","and","allocated","clusters",")","that","were","visualized","by","'ga_visualizer","'",":","@","image","html","ga_clustering_sample_simple_04.png","@","see","ga_visualizer","@","see","ga_observer"]
docstr: !
  @brief Crossovers a pair of chromosomes.
  
  @param[in] chromosome_1 (numpy.array): The first chromosome for crossover.
  @param[in] chromosome_2 (numpy.array): The second chromosome for crossover.
  @param[in] mask (numpy.array): Crossover mask that defines which genes should be swapped.
docstr_tok: ["!","@","brief","Crossovers","a","pair","of","chromosomes",".","@","param","[","in","]","chromosome_1","(","numpy.array",")",":","The","first","chromosome","for","crossover",".","@","param","[","in","]","chromosome_2","(","numpy.array",")",":","The","second","chromosome","for","crossover",".","@","param","[","in","]","mask","(","numpy.array",")",":","Crossover","mask","that","defines","which","genes","should","be","swapped","."]
code: def _crossover_a_pair(chromosome_1, chromosome_2, mask):
      """!
      @brief Crossovers a pair of chromosomes.
  
      @param[in] chromosome_1 (numpy.array): The first chromosome for crossover.
      @param[in] chromosome_2 (numpy.array): The second chromosome for crossover.
      @param[in] mask (numpy.array): Crossover mask that defines which genes should be swapped.
  
      """
  
      for _idx in range(len(chromosome_1)):
          if mask[_idx] == 1:
              # Swap values
              chromosome_1[_idx], chromosome_2[_idx] = (
                  chromosome_2[_idx],
                  chromosome_1[_idx],
              )
  
imports: import numpy
  import matplotlib.pyplot
  import matplotlib.animation
  from pyclustering.cluster import cluster_visualizer
  from pyclustering.cluster.ga_maths import ga_math
label_desc: Use image node_id 8 for calling the genetic_algorithm obj's underlying member method code with example usage: obj._crossover_a_pair(chromosome_1, chromosome_2, mask) without return types