"Utility functions for evolutionary algorithms" is software that offers beneficial utility functions, serving as a helping hand in creating efficient algorithms. It is a resourceful tool to have when working with evolutionary algorithms.
For string genes, a gene refers to a sequence of characters, and a position in the gene refers to a single character. For array genes, a gene refers to an array reference, and a position in the gene refers to an array element.
The module provides several functions for evolutionary algorithms. The str_crossover and arr_crossover functions return a random N-point crossover between two given genes. $N defaults to 2, and must be less than the size of the genes. The two inputs can have different lengths.
The str_agreement and arr_agreement functions return the number of positions in which the two genes agree. For string genes, comparison is done in a non-unicode-friendly way, but can be changed to a (slower) unicode-friendly string comparison by setting $Algorithm::Evolve::Util::UNICODE_STRINGS to a true value. For array genes, the comparison of individual elements is done with eq. Note that this uses the Hamming metric and not the edit distance metric.
The str_mutate and arr_mutate functions return a random mutation of the gene according to the given alphabet, defaulting to {0,1}. If $num is less than 1, it performs probabilistic mutation, with each position having a $num probability of being mutated. If $num is greater than or equal to 1, it performs N-point mutation, with exactly $num positions chosen at random and mutated. A mutation rate of 1/gene_length is recommended. The function will always change the character in question and will never replace a character with the same character.
The str_random and arr_random functions return a random gene of the given size over the given alphabet, defaulting to {0,1}. The alphabet should consist of single characters for string genes, and can be anything meaningful to the user for array genes.
Overall, Algorithm::Evolve::Util provides a useful set of functions for those looking to implement evolutionary algorithms with Perl.
Version 0.03: N/A