AI-Genetic-Pro

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

1.003 Sun, 15 Nov 2020 09:14:05 +0100
	- Fixed bug causing "internal error" in a case of cloning raw chromosomes.

1.002 Sat, 14 Nov 2020 21:33:38 +0100
	- Fixed bug in a documentation.

1.001 Sat, 14 Nov 2020 19:20:53 +0100
	- Fixed bug in a documentation.

1.000 Sat, 14 Nov 2020 18:03:39 +0100
	- Added support (long awaited ;) for multi-core processing, through MCE.
	- Added direct support for native arrays instead of packed scalars (for chromosomes).
	- Some bug fixes.

0.401 Fri, 19 Nov 2011 19:22:45 +0100
	- Some bug fixes.

0.341 Mon, 23 Mar 2009 17:21:52 +0100
	- Fixed bug in a documentation. Thanks to Randal L. Schwartz :-)

0.34  Tue, 17 Mar 2009 20:39:16 +0100 

META.json  view on Meta::CPAN

{
   "abstract" : "Efficient genetic algorithms for professional purpose with support for multiprocessing.",
   "author" : [
      "\u0141ukasz Strzelecki <lukasz@strzeleccy.eu>"
   ],
   "dynamic_config" : 0,
   "generated_by" : "Dist::Zilla version 6.017, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "lgpl_2_1"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",

META.yml  view on Meta::CPAN

---
abstract: 'Efficient genetic algorithms for professional purpose with support for multiprocessing.'
author:
  - 'Łukasz Strzelecki <lukasz@strzeleccy.eu>'
build_requires: {}
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.017, CPAN::Meta::Converter version 2.150010'
license: lgpl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html

Makefile.PL  view on Meta::CPAN

# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.017.
use strict;
use warnings;



use ExtUtils::MakeMaker;

my %WriteMakefileArgs = (
  "ABSTRACT" => "Efficient genetic algorithms for professional purpose with support for multiprocessing.",
  "AUTHOR" => "\x{141}ukasz Strzelecki <lukasz\@strzeleccy.eu>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "AI-Genetic-Pro",
  "LICENSE" => "lgpl",
  "NAME" => "AI::Genetic::Pro",
  "PREREQ_PM" => {
    "Carp" => 0,
    "Class::Accessor::Fast::XS" => 0,

README  view on Meta::CPAN

NAME

    AI::Genetic::Pro - Efficient genetic algorithms for professional
    purpose with support for multiprocessing.

SYNOPSIS

        use AI::Genetic::Pro;
        
        sub fitness {
            my ($ga, $chromosome) = @_;
            return oct('0b' . $ga->as_string($chromosome)); 
        }
        

README  view on Meta::CPAN

         
        # save state of GA
        $ga->save('genetic.sga');
        
        # load state of GA
        $ga->load('genetic.sga');

DESCRIPTION

    This module provides efficient implementation of a genetic algorithm
    for professional purpose with support for multiprocessing. It was
    designed to operate as fast as possible even on very large populations
    and big individuals/chromosomes. AI::Genetic::Pro was inspired by
    AI::Genetic, so it is in most cases compatible (there are some
    changes). Additionally AI::Genetic::Pro isn't a pure Perl solution, so
    it doesn't have limitations of its ancestor (such as slow-down in the
    case of big populations ( >10000 ) or vectors with more than 33
    fields).

    If You are looking for a pure Perl solution, consider AI::Genetic.

    Speed

      To increase speed XS code is used, however with portability in mind.
      This distribution was tested on Windows and Linux platforms (and
      should work on any other).

      Multicore support is available through Many-Core Engine (MCE). You
      can gain the most speed up for big populations or time/CPU consuming
      fitness functions, however for small populations and/or simple
      fitness function better choice will be single-process version.

      You can get even more speed up if you turn on use of native arrays
      (parameter: native) instead of packing chromosomes into single
      scalar. However you have to remember about expensive memory use in
      that case.

    Memory

      This module was designed to use as little memory as possible. A
      population of size 10000 consisting of 92-bit vectors uses only ~24MB
      (AI::Genetic would use about 78MB). However - if you use MCE - there
      will be bigger memory consumption. This is consequence of necessity
      of synchronization between many processes.

    Advanced options

      To provide more flexibility AI::Genetic::Pro supports many
      statistical distributions, such as uniform, natural, chi_square and
      others. This feature can be used in selection and/or crossover. See
      the documentation below.

METHODS

README  view on Meta::CPAN

      -native

	This defines whether native arrays should be used instead of
	packing each chromosome into signle scalar. Turning this option can
	give you speed up, but much more memory will be used. Allowed
	values are 1 or 0 (default: 0).

      -mce

	This defines whether Many-Core Engine (MCE) should be used during
	processing. This can give you significant speed up on many-core/CPU
	systems, but it'll increase memory consumption. Allowed values are
	1 or 0 (default: 0).

      -workers

	This option has any meaning only if MCE is turned on. This defines
	how many process will be used during processing. Default will be
	used one proces per core (most efficient).

      -strict

	This defines if the check for modifying chromosomes in a
	user-defined fitness function is active. Directly modifying
	chromosomes is not allowed and it is a highway to big trouble. This
	mode should be used only for testing, because it is slow.

    $ga->inject($chromosomes)

lib/AI/Genetic/Pro.pm  view on Meta::CPAN

	return $minmax[1], int($mean), $minmax[0];
}
#=======================================================================
1;


__END__

=head1 NAME

AI::Genetic::Pro - Efficient genetic algorithms for professional purpose with support for multiprocessing.

=head1 SYNOPSIS

    use AI::Genetic::Pro;
    
    sub fitness {
        my ($ga, $chromosome) = @_;
        return oct('0b' . $ga->as_string($chromosome)); 
    }
    

lib/AI/Genetic/Pro.pm  view on Meta::CPAN

     
    # save state of GA
    $ga->save('genetic.sga');
    
    # load state of GA
    $ga->load('genetic.sga');

=head1 DESCRIPTION

This module provides efficient implementation of a genetic algorithm for
professional purpose with support for multiprocessing. It was designed to operate as fast as possible
even on very large populations and big individuals/chromosomes. C<AI::Genetic::Pro> 
was inspired by C<AI::Genetic>, so it is in most cases compatible 
(there are some changes). Additionally C<AI::Genetic::Pro> isn't a pure Perl solution, so it 
doesn't have limitations of its ancestor (such as slow-down in the
case of big populations ( >10000 ) or vectors with more than 33 fields).

If You are looking for a pure Perl solution, consider L<AI::Genetic>.

=over 4

=item Speed

To increase speed XS code is used, however with portability in 
mind. This distribution was tested on Windows and Linux platforms 
(and should work on any other).

Multicore support is available through Many-Core Engine (C<MCE>). 
You can gain the most speed up for big populations or time/CPU consuming 
fitness functions, however for small populations and/or simple fitness 
function better choice will be single-process version.

You can get even more speed up if you turn on use of native arrays 
(parameter: C<native>) instead of packing chromosomes into single scalar. 
However you have to remember about expensive memory use in that case.

=item Memory

This module was designed to use as little memory as possible. A population
of size 10000 consisting of 92-bit vectors uses only ~24MB (C<AI::Genetic> 
would use about 78MB). However - if you use MCE - there will be bigger 
memory consumption. This is consequence of necessity of synchronization 
between many processes.

=item Advanced options

To provide more flexibility C<AI::Genetic::Pro> supports many 
statistical distributions, such as C<uniform>, C<natural>, C<chi_square>
and others. This feature can be used in selection and/or crossover. See
the documentation below.

=back

lib/AI/Genetic/Pro.pm  view on Meta::CPAN


This defines whether history should be collected. Allowed values are 1 or 0 (default: I<0>).

=item -native 

This defines whether native arrays should be used instead of packing each chromosome into signle scalar. 
Turning this option can give you speed up, but much more memory will be used. Allowed values are 1 or 0 (default: I<0>).

=item -mce

This defines whether Many-Core Engine (MCE) should be used during processing. 
This can give you significant speed up on many-core/CPU systems, but it'll 
increase memory consumption. Allowed values are 1 or 0 (default: I<0>).

=item -workers

This option has any meaning only if MCE is turned on. This defines how 
many process will be used during processing. Default will be used one proces per core (most efficient).

=item -strict

This defines if the check for modifying chromosomes in a user-defined fitness
function is active. Directly modifying chromosomes is not allowed and it is 
a highway to big trouble. This mode should be used only for testing, because it is B<slow>.

=back

=item I<$ga>-E<gt>B<inject>($chromosomes)



( run in 0.329 second using v1.01-cache-2.11-cpan-8d75d55dd25 )