Fitness_Function.py

class Organisms.GA.Fitness_Operators.Fitness_Function.Fitness_Function(**entries)

This class is designed to calculator the fitness value of a cluster, given a value of rho_i. This class will include all the relavant information required, such as parameters, needed for the functions to convert rho_i into a fitness value.

Parameters:

entries (dict.) – This is a dictionary that contains all the input variables required for the fitness function.

direct_function(rho_i)

This definition is designed to return the value for rho_i without any mathematical changes to it.

Equation written as required in the genetic algorithm.

Parameters:

rho_i (float) – a value

Returns:

rho_i

Rtypes:

float

exponential_function(rho_i)

This definition is designed to return the result of the exp function for this genetic algorithm.

Equation written as required in the genetic algorithm.

Parameters:
  • rho_i (float) – a value

  • alpha (float) – a value

Returns:

value

Rtypes:

float

get_fitness(rho_i)

This def will give the fitness value for a given value of rho_i

Parameters:

rho_i (float) – a value

Returns:

value

Rtypes:

float

linear_function(rho_i)

This definition is designed to return the result of the linear function for this genetic algorithm.

Equation written as required in the genetic algorithm.

Parameters:
  • rho_i (float) – a value

  • gradient (float) – a value

  • coefficent (float) – a value

Returns:

value

Rtypes:

float

tanh_function(rho_i)

This definition is designed to return the result of the tanh function for this genetic algorithm.

Equation written as required in the genetic algorithm.

Parameters:

rho_i (float) – a value

Returns:

value

Rtypes:

float