Closed phinate closed 1 year ago
I've also ensured that pokemon cannot be modified in-place by storing them in a tuple
, and making the Team
module an immutable dataclass. With this and a bunch of duplicate checking, I have yet to encounter #36!
oh aaaaaaand there's support again to write-out teams in the main function -- see p2lab --help
:)
i've requested a couple reviews:
All tests are passing on latest commit for me.
I'm gonna merge this since I think it's a good base to build on -- we can work out any creases in the genetic algorithm with separate PRs :)
I've also ensured that pokemon cannot be modified in-place by storing them in a
tuple
, and making theTeam
module an immutable dataclass. With this and a bunch of duplicate checking, I have yet to encounter #36!
This is scary in terms of performance, no?
This is scary in terms of performance, no?
from what? i haven't noticed a slowdown, don't think that the object types here are an issue -- feel free to benchmark something and show me!
Also, @phinate https://github.com/alan-turing-institute/p2lab-pokemon/actions/runs/5399005143/jobs/9805574268 any thoughts on this does this need to be raised as an issue?
Also, @phinate https://github.com/alan-turing-institute/p2lab-pokemon/actions/runs/5399005143/jobs/9805574268 any thoughts on this does this need to be raised as an issue?
Ty, just made #57
turns out the use of
deepcopy
in theTeam
class in #36 #40 #41 didn't actually fix our issue -- the cause is probably right since it always happens with duplicate pokemon, but this didn't make the pokemon separate from the point of view of the bot.this fixes the issue indirectly in
fitness_mutate
andmutate
by forcing a resampling whenever duplicate pokemon are generated for the same team. additionally, there's a hard guard to this inTeam
now which checks the pokemon upon initialisation.what's not protected against is modifying the
.pokemon
attribute directly, so I've made this a tuple for now -- needs some ironing out for use in the crossover methods, since they've been designed for numpy arrays. (i cast once or twice atm to get partially around this).