class_docstr: !
  @brief Genetic algorithm observer that is used to collect information about clustering process on each iteration.
class_docstr_tok: ["!","@","brief","Genetic","algorithm","observer","that","is","used","to","collect","information","about","clustering","process","on","each","iteration","."]
docstr: !
  @brief Constructs genetic algorithm observer to collect specific information.
  
  @param[in] need_global_best (bool): If 'True' then the best chromosomes and its fitness function value (global optimum) for each iteration are stored.
  @param[in] need_population_best (bool): If 'True' then current (on each iteration) best chromosomes and its fitness function value (local optimum) are stored.
  @param[in] need_mean_ff (bool): If 'True' then average value of fitness function on each iteration is stored.
docstr_tok: ["!","@","brief","Constructs","genetic","algorithm","observer","to","collect","specific","information",".","@","param","[","in","]","need_global_best","(","bool",")",":","If","'True","'","then","the","best","chromosomes","and","its","fitness","function","value","(","global","optimum",")","for","each","iteration","are","stored",".","@","param","[","in","]","need_population_best","(","bool",")",":","If","'True","'","then","current","(","on","each","iteration",")","best","chromosomes","and","its","fitness","function","value","(","local","optimum",")","are","stored",".","@","param","[","in","]","need_mean_ff","(","bool",")",":","If","'True","'","then","average","value","of","fitness","function","on","each","iteration","is","stored","."]
code: def __init__(
      self,
      need_global_best=False,
      need_population_best=False,
      need_mean_ff=False,
  ):
      """!
      @brief Constructs genetic algorithm observer to collect specific information.
  
      @param[in] need_global_best (bool): If 'True' then the best chromosomes and its fitness function value (global optimum) for each iteration are stored.
      @param[in] need_population_best (bool): If 'True' then current (on each iteration) best chromosomes and its fitness function value (local optimum) are stored.
      @param[in] need_mean_ff (bool): If 'True' then average value of fitness function on each iteration is stored.
  
      """
  
      # Global best chromosome and fitness function for each population
      self._global_best_result = {
          "chromosome": [],
          "fitness_function": [],
      }
  
      # Best chromosome and fitness function on a population
      self._best_population_result = {
          "chromosome": [],
          "fitness_function": [],
      }
  
      # Mean fitness function on each population
      self._mean_ff_result = []
  
      # Flags to collect
      self._need_global_best = need_global_best
      self._need_population_best = need_population_best
      self._need_mean_ff = need_mean_ff
  
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 1 to create a new ga_observer object  with example: obj = ga_observer(need_global_best, need_population_best, need_mean_ff)