08 Feb 2018 08:45:34 UTC
- Distribution: Algorithm-Evolutionary-Utils
- Module version: 4.00.00
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (651 / 0 / 0)
- KwaliteeBus factor: 1
- License: open_source
- Activity24 month
- Download (15.76KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionJMERELO J. J. Merelo-Guervósand 1 contributors
- JJ Merelo <jj /at/ merelo.net>
- genotypic_entropy( $population)
- hamming( $string_a, $string_b )
- consensus( $population, $rough = 0 )
- random_bitstring( $bits[, $chromify = 0 ] )
- random_number_array( $dimensions [, $min = -1] [, $range = 2] )
- decode_string( $chromosome, $gene_size, $min, $range )
- vector_compare( $vector_1, $vector_2 )
- SEE ALSO
Algorithm::Evolutionary::Utils - Collection of functions used in all kind of evolutionary algorithms..
use Algorithm::Evolutionary::Utils qw(entropy genotypic_entropy hamming consensus average random_bitstring random_number_array decode_string vector_compare ); my $this_entropy = entropy( $population ); #Computes consensus sequence (for binary chromosomes my $this_consensus = consensus( $population);
Miscellaneous class that contains functions that might be useful somewhere else, especially when computing EA statistics.
Computes the entropy using the well known Shannon's formula: http://en.wikipedia.org/wiki/Information_entropy 'to avoid botching highlighting; in this case we use chromosome frequencies instead of fitness.
Computes the number of bit positions that are different among two strings, the well known Hamming distance.
Consensus sequence representing the majority value for each bit; returns the consensus binary string. If "rough", then the bit is set only if the difference is bigger than 0.2 (60/40 proportion). Otherwise, it is set to
Returns a random bitstring with the stated number of bits. Useful for testing, mainly. Returns a "chromosome-like" object if $chromify is 1, mainly putting it into a hashref with the
Returns a random number array with the stated length. Useful for testing, mainly.
Decodes to a vector, each one of whose components ranges between $min and $max. Returns that vector.
It does not work for $gene_size too big. Certainly not for 64, maybe for 32.
Compares vectors, returns 1 if 1 dominates 2, -1 if it's the other way round, and 0 if neither dominates the other. Both vectors are supposed to be numeric. Returns
0if neither is bigger, and they are not equal. Fails if the length is not the same. None of the combinations above returns
This is a spin off from Algorithm::Evolutionary so it's worth the while to check it out. And the spinning was due to finding I needed to include it in examples for the much simpler Algorithm::Evolutionary::Simple.
This file is released under the GPL. See the LICENSE file included in this distribution, or go to http://www.fsf.org/licenses/gpl.txt
Module Install Instructions
To install Algorithm::Evolutionary::Utils, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Algorithm::Evolutionary::Utils
For more information on module installation, please visit the detailed CPAN module installation guide.