in reply to Re^2: AI::Genetic gives me strange warnings
in thread AI::Genetic gives me strange warnings

As ugly as it seems, a workaround (not denying a likely perl bug here) is to use $::a and $::b in the inner sort. Which may mean patching AI::Genetic... although I don't know what that will do during non-embedded sorts.

  • Comment on Re^3: AI::Genetic gives me strange warnings

Replies are listed 'Best First'.
Re^4: AI::Genetic gives me strange warnings
by fizbin (Chaplain) on Feb 23, 2005 at 15:23 UTC
    Actually, there's a much, much easier patch to AI::Genetic that doesn't potentially screw up other non-embedded sorts. I've already communicated this to the AI::Genetic author, but you can see what's necessary in (the updated) 433606. It relies on the fact that individuals in an AI::Genetic population remember their score values once they've computed them. (Which is necessary for even vaguely decent performance when the fitness function gets a bit hairy)

    It's a very small three-line change, and does leave open the possibility of people screwing with the internals of the AI::Genetic object if they assign to $_, but you shouldn't be assigning to $_ in any case without using local to limit the effects of your changes.

    Also note that it's not the inner sort you'd be changing if you're changing AI::Genetic but the outer sort; the inner sort is already inside package main.

    -- @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/