From aaa733d789612289396d69bb6cf3a0e5de1798a8 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 4 Aug 2012 16:59:49 -0600 Subject: Optomized the mating / mutation setup. It should work the same, but it selects the number of bits to mutate first, then selects the individual bits instead of testing a random number on each bit. For very large phenotypes this will be significantly faster while producing about the same result. --- src/tests/binary.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/tests') diff --git a/src/tests/binary.cpp b/src/tests/binary.cpp index 727feec..3e2cbc7 100644 --- a/src/tests/binary.cpp +++ b/src/tests/binary.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include using namespace Bu; @@ -13,7 +14,7 @@ int main( int argc, char *argv[] ) Bu::Random::setGenerator(); Bu::Random::seed( time( NULL ) ); - Genetic::OperatorBasic op( new Genetic::PhenotypeBinary( 422*1024 ), 0.0 ); + Genetic::OperatorBasic op( new Genetic::PhenotypeBinary( 3453120 ), 0.000125 ); Genetic::Phenotype *pPb1 = op.random(); Genetic::Phenotype *pPb2 = op.random(); Genetic::Phenotype *pPb3; -- cgit v1.2.3