AI-Genetic-Pro
    
    
  
  
  
view release on metacpan or search on metacpan
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 
	- Fixed bug in PMX strategy. Thanks to Maciej Misiak :-)
0.335 Sat, 07 Feb 2009 20:04:52 +0100
	- Little changes in a Makefile.PL (especially for Sun Solaris)
0.334 Fri, 23 Jan 2009 00:03:26 +0100
	- Module 'Digest::MD5' is loaded by default,
0.333 Fri, 22 Jan 2009 15:30:06 +0100
	- Some improvments in 'getFittest' function,
	- Added 'getFittest_as_arrayref' function,
0.332 Wed, 21 Jan 2009 00:31:01 +0100
	- Some changes in tests.
0.331 Tue, 20 Jan 2009 23:55:20 +0100
	- Added tests.
	- Some improvments in the 'inject' function.
0.33 Mon, 19 Jan 2009 00:38:06 +0100
	- Added 'strict' mode.
	- Added 'inject' function.
0.32 Sun, 18 Jan 2009 01:16:37 +0100
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also
counts as the successor of the GNU Library Public License,
version 2, hence the version number 2.1.]
Preamble
The licenses for most software are designed to take away
your freedom to share and change it. By contrast, the GNU
General Public Licenses are intended to guarantee your
freedom to share and change free software--to make sure the
software is free for all its users.
This license, the Lesser General Public License, applies to
some specially designated software packages--typically
libraries--of the Free Software Foundation and other authors
who decide to use it. You can use it too, but we suggest you
first think carefully about whether this license or the ordinary
General Public License is the better strategy to use in any
particular case, based on the explanations below.
When we speak of free software, we are referring to freedom
of use, not price. Our General Public Licenses are designed
to make sure that you have the freedom to distribute copies
of free software (and charge for this service if you wish); that
you receive source code or can get it if you want it; that you
can change the software and use pieces of it in new free
programs; and that you are informed that you can do these
things.
To protect your rights, we need to make restrictions that
forbid distributors to deny you these rights or to ask you to
surrender these rights. These restrictions translate to certain
responsibilities for you if you distribute copies of the library
or if you modify it.
For example, if you distribute copies of the library, whether
gratis or for a fee, you must give the recipients all the rights
that we gave you. You must make sure that they, too,
receive or can get the source code. If you link other code
with the library, you must provide complete object files to the
recipients, so that they can relink them with the library after
making changes to the library and recompiling it. And you
must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we
copyright the library, and (2) we offer you this license, which
gives you legal permission to copy, distribute and/or modify
the library.
To protect each distributor, we want to make it very clear
that there is no warranty for the free library. Also, if the
library is modified by someone else and passed on, the
1. You may copy and distribute verbatim copies of the
Library's complete source code as you receive it, in any
medium, provided that you conspicuously and appropriately
publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer
to this License and to the absence of any warranty; and
distribute a copy of this License along with the Library.
You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.
2. You may modify your copy or copies of the Library or any
portion of it, thus forming a work based on the Library, and
copy and distribute such modifications or work under the
terms of Section 1 above, provided that you also meet all of
these conditions:
     a) The modified work must itself be a software
     library.
     b) You must cause the files modified to carry
     prominent notices stating that you changed the
     files and the date of any change.
     c) You must cause the whole of the work to be
     licensed at no charge to all third parties under
     the terms of this License.
     d) If a facility in the modified Library refers to a
     function or a table of data to be supplied by an
     application program that uses the facility, other
     than as an argument passed when the facility
     is invoked, then you must make a good faith
     effort to ensure that, in the event an application
     does not supply such function or table, the
     License.
3. You may opt to apply the terms of the ordinary GNU
General Public License instead of this License to a given
copy of the Library. To do this, you must alter all the notices
that refer to this License, so that they refer to the ordinary
GNU General Public License, version 2, instead of to this
License. (If a newer version than version 2 of the ordinary
GNU General Public License has appeared, then you can
specify that version instead if you wish.) Do not make any
other change in these notices.
Once this change is made in a given copy, it is irreversible
for that copy, so the ordinary GNU General Public License
applies to all subsequent copies and derivative works made
from that copy.
This option is useful when you wish to copy part of the code
of the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable
form under the terms of Sections 1 and 2 above provided that
you accompany it with the complete corresponding
machine-readable source code, which must be distributed
under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange.
If distribution of object code is made by offering access to
copy from a designated place, then offering equivalent
access to copy the source code from the same place
satisfies the requirement to distribute the source code, even
though third parties are not compelled to copy the source
along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being
You must give prominent notice with each copy of the work
that the Library is used in it and that the Library and its use
are covered by this License. You must supply a copy of this
License. If the work during execution displays copyright
notices, you must include the copyright notice for the Library
among them, as well as a reference directing the user to the
copy of this License. Also, you must do one of these things:
     a) Accompany the work with the complete
     corresponding machine-readable source code
     for the Library including whatever changes were
     used in the work (which must be distributed
     under Sections 1 and 2 above); and, if the work
     is an executable linked with the Library, with
     the complete machine-readable "work that
     uses the Library", as object code and/or
     source code, so that the user can modify the
     Library and then relink to produce a modified
     executable containing the modified Library. (It
     is understood that the user who changes the
     contents of definitions files in the Library will
     not necessarily be able to recompile the
     application to use the modified definitions.)
     b) Use a suitable shared library mechanism for
     linking with the Library. A suitable mechanism
     is one that (1) uses at run time a copy of the
     library already present on the user's computer
     system, rather than copying library functions
     into the executable, and (2) will operate
                  "signoff" : 0
               },
               "Dist::Zilla::Role::Git::DirtyFiles" : {
                  "allow_dirty" : [
                     "Changes",
                     "dist.ini"
                  ],
                  "allow_dirty_match" : [
                     "(?^u:.*(?:\\.pm|README|\\*.t)$)"
                  ],
                  "changelog" : "Changes"
               },
               "Dist::Zilla::Role::Git::Repo" : {
                  "git_version" : "2.30.2",
                  "repo_root" : "."
               },
               "Dist::Zilla::Role::Git::StringFormatter" : {
                  "time_zone" : "local"
               }
            },
            "name" : "Git::Commit",
        Dist::Zilla::Plugin::Git::Commit:
          add_files_in: []
          commit_msg: 'Release v%v%n%n%c'
          signoff: 0
        Dist::Zilla::Role::Git::DirtyFiles:
          allow_dirty:
            - Changes
            - dist.ini
          allow_dirty_match:
            - (?^u:.*(?:\.pm|README|\*.t)$)
          changelog: Changes
        Dist::Zilla::Role::Git::Repo:
          git_version: 2.30.2
          repo_root: .
        Dist::Zilla::Role::Git::StringFormatter:
          time_zone: local
      name: Git::Commit
      version: '2.047'
    -
      class: Dist::Zilla::Plugin::Git::Push
      config:
        # 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
    $ga->generation()
      Get the number of the current generation.
    $ga->people()
      Returns an anonymous list of individuals/chromosomes of the current
      population.
      IMPORTANT: the actual array reference used by the AI::Genetic::Pro
      object is returned, so any changes to it will be reflected in $ga.
    $ga->chromosomes()
      Alias for people.
    $ga->chart(%options)
      Generate a chart describing changes of min, mean, and max scores in
      your population. To satisfy your needs, you can pass the following
      options:
      -filename
	File to save a chart in (obligatory).
      -title
	Title of a chart (default: Evolution).
Class::Accessor::Fast::XS	= 0
Storable					= 2.05
GD::Graph::linespoints		= 1.54
MCE							= 1.874
MCE::Map					= 1.874
[GithubMeta]
remote = d-strzelec
[Git::Commit]
changelog			= Changes
commit_msg			= Release v%v%n%n%c
allow_dirty_match	= .*(?:\.pm|README|\*.t)$
[Git::Push]
push_to		= d-strzelec
[TestRelease]
[ConfirmRelease]
[UploadToCPAN]
;[FakeRelease]
lib/AI/Genetic/Pro.pm view on Meta::CPAN
    
    # 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 
lib/AI/Genetic/Pro.pm view on Meta::CPAN
=item I<$ga>-E<gt>B<generation>()
Get the number of the current generation.
=item I<$ga>-E<gt>B<people>()
Returns an anonymous list of individuals/chromosomes of the current population. 
B<IMPORTANT:> the actual array reference used by the C<AI::Genetic::Pro> 
object is returned, so any changes to it will be reflected in I<$ga>.
=item I<$ga>-E<gt>B<chromosomes>()
Alias for C<people>.
=item I<$ga>-E<gt>B<chart>(%options)
Generate a chart describing changes of min, mean, and max scores in your
population. To satisfy your needs, you can pass the following options:
=over 4
=item -filename
File to save a chart in (B<obligatory>).
=item -title
lib/AI/Genetic/Pro/Mutation/Bitvector.pm view on Meta::CPAN
				#@{ $chromosomes->[ $idx ] } = reverse @{ $chromosomes->[ $idx ] };
				
			}else{
				my $id = int rand @{$chromosomes->[$idx]};
				$chromosomes->[$idx]->[$id] = $chromosomes->[$idx]->[$id] ? 0 : 1;
			}
		}else{
			my $id = int rand @{$chromosomes->[$idx]};
			$chromosomes->[$idx]->[$id] = $chromosomes->[$idx]->[$id] ? 0 : 1;	
		}
		# we need to change fitness
		$_fitness->{$idx} = $fitness->($ga, $chromosomes->[$idx]);
	}
	
	return 1;
}
#=======================================================================
# too slow; mutation is too dangerous in this solution
sub run0 {
	my ($self, $ga) = @_;
lib/AI/Genetic/Pro/Mutation/Combination.pm view on Meta::CPAN
		elsif($rand < $mutation){
			my $el = int rand @{$chromosomes->[$idx]};
			my $new = int rand @{$_translations->[0]};
			next if $new == $chromosomes->[$idx]->[$el];
			
			my $id = first_index { $_ == $new } @{$chromosomes->[$idx]};
			$chromosomes->[$idx]->[$id] = $chromosomes->[$idx]->[$el] if defined $id and $id != -1;
			$chromosomes->[$idx]->[$el] = $new;
		}
		
		# we need to change fitness
		$_fitness->{$idx} = $fitness->($ga, $chromosomes->[$idx]);
	}
	
	return 1;
}
#=======================================================================
1;
lib/AI/Genetic/Pro/Mutation/Listvector.pm view on Meta::CPAN
				}
			}else{
				my $id = $min + int rand($range - 1);
				$chromosomes->[$idx]->[$id] = 1 + int rand $#{$_translations->[$id]};
			}
		}else{
			my $id = int rand @{$chromosomes->[$idx]};
			$chromosomes->[$idx]->[$id] = 1 + int rand $#{$_translations->[$id]};
		}
		
		# we need to change fitness
		$_fitness->{$idx} = $fitness->($ga, $chromosomes->[$idx]);
	}
	
	return 1;
}
#=======================================================================
1;
lib/AI/Genetic/Pro/Mutation/Rangevector.pm view on Meta::CPAN
				}
			}else{
				my $id = $min + int rand($range - 1);
				$chromosomes->[$idx]->[$id] = random_uniform_integer(1, @{$_translations->[$id]}[1..2]);	
			}
		}else{
			my $id = int rand @{$chromosomes->[$idx]};
			$chromosomes->[$idx]->[$id] = random_uniform_integer(1, @{$_translations->[$id]}[1..2]);	
		}
		
		# we need to change fitness
		$_fitness->{$idx} = $fitness->($ga, $chromosomes->[$idx]);
	}
	
	return 1;
}
#=======================================================================
sub run0 {
	my ($self, $ga) = @_;
	# this is declared here just for speed
( run in 0.876 second using v1.01-cache-2.11-cpan-c333fce770f )