29 Mar 2021 11:30:17 UTC
- Distribution: Algorithm-Evolutionary
- Module version: 3.3
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (132 / 0 / 0)
- KwaliteeBus factor: 1
- License: open_source
- Download (97.19KB)
- MetaCPAN Explorer
- Subscribe to distribution
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- This version
- Latest version++ed by:1 non-PAUSE user
J. J. Merelo-Guervós /
- JJ Merelo <jj /at/ merelo.net>
- Known subclasses
Algorithm::Evolutionary::Individual::Base - Base class for chromosomes that knows how to build them, and has some helper methods.
use Algorithm::Evolutionary::Individual::Base; my $indi = Algorithm::Evolutionary::Individual::Base->fromParam( $param_hashref ); #From parametric description $binIndi2->Fitness( 3.5 ); #Sets or gets fitness print $binIndi2->Fitness(); my $emptyIndi = new Algorithm::Evolutionary::Individual::Base;
Base class for individuals, that is, "chromosomes" in evolutionary computation algorithms. However, chromosomes needn't be bitstrings, so the name is a bit misleading. This is, however, an "empty" base class, that acts as a boilerplate for deriving others.
Creates methods for instance variables automatically
Creates a new Base individual of the required class, with a fitness, and sets fitnes to undef. Takes as params a hash to the options of the individual, that will be passed on to the object of the class when it iss initialized.
Creates a new individual, but uses a different interface: takes a ref-to-hash, with named parameters, which gives it a common interface to all the hierarchy. The main difference with respect to new is that after creation, it is initialized with random values.
Sets values of an individual; takes a hash as input. Keys are prepended an underscore and turn into instance variables
Prints it as YAML.
Prints it as a string in the most meaningful representation possible
Prints it as a string followed by fitness. Separator by default is
Sets or gets the value of an atom; each individual is divided in atoms, which can be accessed sequentially. If that does not apply, Atom can simply return the whole individual
Sets or gets fitness
Operators that can act on this data structure. Returns an array with the names of the known operators
Evaluates using the $fitness thingy given. Can be a Algorithm::Evolutionary::Fitness::Base object or a ref-to-sub
Sets or gets the chromosome itself, that is, the data structure evolved. Since each derived class has its own data structure, and its own name, it is left to them to return it
OK, OK, this is utter inconsistence, but I'll re-consistence it eventually. Returns a meaningful size; but should be reimplemented by siblings
There are others, but I'm not so sure they work.
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, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Algorithm::Evolutionary
For more information on module installation, please visit the detailed CPAN module installation guide.
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|