search.cpan.org is shutting down
J. J. Merelo-Guervós > Algorithm-MasterMind-v0.4.5 > Algorithm::MasterMind::EDA

Algorithm-MasterMind-v0.4.5.tar.gz

Dependencies

Annotate this POD

# CPAN RT

 Open 1
View/Report Bugs
Module Version: 1.013

# NAME

Algorithm::MasterMind::EDA - Solver using an Estimation of Distribution Algorithm

# SYNOPSIS

```    use Algorithm::MasterMind::EDA;
my \$secret_code = 'EAFC';
my \$population_size = 200;
my @alphabet = qw( A B C D E F );
my \$solver = new Algorithm::MasterMind::EDA { alphabet => \@alphabet,
length => length( \$secret_code ),
pop_size => \$population_size};

#The rest, same as the other solvers```

# DESCRIPTION

Uses Algorithm::Evolutionary instance of EDAs to solve MM; as there are two different fitness functions you can use; probably `fitness_orig` works better.

# INTERFACE

## initialize

Performs bookkeeping, and assigns flags depending on the initialization values

## new ( \$options )

This function, and all the rest, are directly inherited from base

## issue_first()

Yields the first combination

## issue_next()

Issues the next combination

## feedback()

Obtain the result to the last combination played

## guesses()

Total number of guesses

## evaluated()

Total number of combinations checked to issue result

## number_of_rules ()

Returns the number of rules in the algorithm

## rules()

Returns the rules (combinations, blacks, whites played so far) y a reference to array

## matches( \$string )

Returns a hash with the number of matches, and whether it matches every rule with the number of blacks and whites it obtains with each of them

## fitness( \$individual )

Computes fitness summing the number of correct black and whites plus the number of rules the combination meets times the length

## fitness_orig( \$individual )

Fitness proposed in the Applied and Soft Computing paper, difference between the number of blacks/whites obtained by rules against the secret code and by the combination against the combination in the rule.

Other solvers: Algorithm::MasterMind::Sequential and Algorithm::MasterMind::Random. Don't work as well, really.

# AUTHOR

JJ Merelo `<jj@merelo.net>`

Copyright (c) 2009, JJ Merelo `<jj@merelo.net>`. All rights reserved.