C
Calvin
use AI::Genetic;
my $ga = new AI::Genetic( -fitness => sub { rand },
-type => 'bitvector',
-population => 500,
-crossover => 0.89,
-mutation => 0.01,
-terminate => sub {
$ga->getFittest->score() > 0.9 } );
$ga->init(10);
$ga->evolve('rouletteTwoPoint', 100);
print "Best score = ", $ga->getFittest->score(), "\n";
The above code is taken from the man page for AI::Genetic (with a bit
of cleanup and modification).
What I'm trying to do is replace "sub { rand }" with something more
meaningful. But to do that I need to be able to say something, in
C++, to the effect of "this.genes()". Any help that could be provided
would be greatly apreciated.
my $ga = new AI::Genetic( -fitness => sub { rand },
-type => 'bitvector',
-population => 500,
-crossover => 0.89,
-mutation => 0.01,
-terminate => sub {
$ga->getFittest->score() > 0.9 } );
$ga->init(10);
$ga->evolve('rouletteTwoPoint', 100);
print "Best score = ", $ga->getFittest->score(), "\n";
The above code is taken from the man page for AI::Genetic (with a bit
of cleanup and modification).
What I'm trying to do is replace "sub { rand }" with something more
meaningful. But to do that I need to be able to say something, in
C++, to the effect of "this.genes()". Any help that could be provided
would be greatly apreciated.