The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Algorithm::Evolutionary::Hash_Wheel - Random selector of things depending on probabilities

SYNOPSIS

    my $wheel = new Algorithm::Evolutionary::Hash_Wheel( \%probs );
    print $wheel->spin(); #Returns an element according to probabilities;

DESCRIPTION

Creates a "roulette wheel" for spinning and selecting stuff. It will be used in several places; mainly in the Algorithm::Evolutionary::Op::CanonicalGA. It's similar to Algorithm::Evolutionary::Wheel, but with a hash instead of an array. Probably should unify both..

METHODS

new( @probabilites )

Creates a new roulette wheel. Takes an array of numbers, which need not be normalized

spin()

Returns an individual whose probability is related to its fitness

Copyright

  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: 2009/09/09 09:02:38 $ 
  $Header: /cvsroot/opeal/Algorithm-Evolutionary/lib/Algorithm/Evolutionary/Hash_Wheel.pm,v 1.1 2009/09/09 09:02:38 jmerelo Exp $ 
  $Author: jmerelo $