GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Algorithm::Evolutionary::Op::Permutation(3) User Contributed Perl Documentation Algorithm::Evolutionary::Op::Permutation(3)

Algorithm::Evolutionary::Op::Permutation - Per-mutation. Got it?

  use Algorithm::Evolutionary::Op::Permutation;

  my $op = new Algorithm::Evolutionary::Op::Permutation ; #Create from scratch
  my $bit_chromosome =  new Algorithm::Evolutionary::Individual::BitString 10;
  $op->apply( $bit_chromosome );

  my $priority = 2;
  my $max_iterations = 100; # Less than 10!, absolute maximum number
                            # of permutations
  $op = new Algorithm::Evolutionary::Op::Permutation $priority, $max_iterations;

  my $xmlStr=<<EOC;
  <op name='Permutation' type='unary' rate='2' />
  EOC
  my $ref = XMLin($xmlStr);

  my $op = Algorithm::Evolutionary::Op::->fromXML( $ref );
  print $op->asXML(), "\n*Arity ->", $op->arity(), "\n";

Algorithm::Evolutionary::Op::Base

Class independent permutation operator; any individual that has the "_str" instance variable (like Algorithm::Evolutionary::Individual::String and Algorithm::Evolutionary::Individual::BitString) will have some of its elements swapped. Each string of length l has l! permutations; the "max_iterations" parameter should not be higher than that.

This kind of operator is used extensively in combinatorial optimization problems. See, for instance, @article{prins2004simple, title={{A simple and effective evolutionary algorithm for the vehicle routing problem}}, author={Prins, C.}, journal={Computers \& Operations Research}, volume={31}, number={12}, pages={1985--2002}, issn={0305-0548}, year={2004}, publisher={Elsevier} }

And, of course, Algorithm::MasterMind, where it is used in the evolutionary algorithms solutions.

Creates a new permutation operator; see Algorithm::Evolutionary::Op::Base for details common to all operators. The chromosome will undergo a random number of at most $max_iterations. By default, it equals 10.

Creates a new mutation operator with an application priority, which defaults to 1.

Called create to distinguish from the classwide ctor, new. It just makes simpler to create an Operator

Applies at most "max_iterations" permutations to a "Chromosome" that includes the "_str" instance variable. The number of iterations will be random, so that applications of the operator on the same individual will create diverse offspring.

Uses Algorithm::Permute, which is purported to be the fastest permutation library around. Might change it in the future to Algorithm::Combinatorics, which is much more comprehensive.

  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

  CVS Info: $Date: 2013/01/09 07:22:50 $ 
  $Header: /media/Backup/Repos/opeal/opeal/Algorithm-Evolutionary/lib/Algorithm/Evolutionary/Op/Permutation.pm,v 3.7 2013/01/09 07:22:50 jmerelo Exp $ 
  $Author: jmerelo $ 
  $Revision: 3.7 $
2014-10-25 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.