pyclustering.cluster.ga.ga_observer Class Reference

Genetic algorithm observer that is used to collect information about clustering process on each iteration. More...

Public Member Functions

def __init__ (self, need_global_best=False, need_population_best=False, need_mean_ff=False)
 Constructs genetic algorithm observer to collect specific information. More...
 
def __len__ (self)
 Returns amount of iterations that genetic algorithm was observed.
 
def collect_global_best (self, best_chromosome, best_fitness_function)
 Stores the best chromosome and its fitness function's value. More...
 
def collect_population_best (self, best_chromosome, best_fitness_function)
 Stores the best chromosome for current specific iteration and its fitness function's value. More...
 
def collect_mean (self, fitness_functions)
 Stores average value of fitness function among chromosomes on specific iteration. More...
 
def get_global_best (self)
 
def get_population_best (self)
 (dict) Returns dictionary with keys 'chromosome' and 'fitness_function' where evolution of the current best chromosome and its fitness function's value (evolution of local optimum) are stored in lists.
 
def get_mean_fitness_function (self)
 (list) Returns fitness function's values on each iteration.
 

Detailed Description

Genetic algorithm observer that is used to collect information about clustering process on each iteration.

Definition at line 44 of file ga.py.

Constructor & Destructor Documentation

◆ __init__()

def pyclustering.cluster.ga.ga_observer.__init__ (   self,
  need_global_best = False,
  need_population_best = False,
  need_mean_ff = False 
)

Constructs genetic algorithm observer to collect specific information.

Parameters
[in]need_global_best(bool): If 'True' then the best chromosomes and its fitness function value (global optimum) for each iteration are stored.
[in]need_population_best(bool): If 'True' then current (on each iteration) best chromosomes and its fitness function value (local optimum) are stored.
[in]need_mean_ff(bool): If 'True' then average value of fitness function on each iteration is stored.

Definition at line 50 of file ga.py.

Member Function Documentation

◆ collect_global_best()

def pyclustering.cluster.ga.ga_observer.collect_global_best (   self,
  best_chromosome,
  best_fitness_function 
)

Stores the best chromosome and its fitness function's value.

Parameters
[in]best_chromosome(list): The best chromosome that were observed.
[in]best_fitness_function(float): Fitness function value of the best chromosome.

Definition at line 87 of file ga.py.

◆ collect_mean()

def pyclustering.cluster.ga.ga_observer.collect_mean (   self,
  fitness_functions 
)

Stores average value of fitness function among chromosomes on specific iteration.

Parameters
[in]fitness_functions(float): Average value of fitness functions among chromosomes.

Definition at line 119 of file ga.py.

◆ collect_population_best()

def pyclustering.cluster.ga.ga_observer.collect_population_best (   self,
  best_chromosome,
  best_fitness_function 
)

Stores the best chromosome for current specific iteration and its fitness function's value.

Parameters
[in]best_chromosome(list): The best chromosome on specific iteration.
[in]best_fitness_function(float): Fitness function value of the chromosome.

Definition at line 103 of file ga.py.

◆ get_global_best()

def pyclustering.cluster.ga.ga_observer.get_global_best (   self)
Returns
(dict) Returns dictionary with keys 'chromosome' and 'fitness_function' where evolution of the best chromosome and its fitness function's value (evolution of global optimum) are stored in lists.

Definition at line 133 of file ga.py.


The documentation for this class was generated from the following file: