alan-turing-institute / p2lab-pokemon

A Python library for running genetic algorithms to optimize Pokemon teams!
BSD 3-Clause "New" or "Revised" License
8 stars 1 forks source link

Possible inconsistent tracking of fitness indicies #57

Open phinate opened 1 year ago

phinate commented 1 year ago

I've been getting some strange behaviour here and there when trying to inspect the Pokemon with highest/lowest fitness etc. As an example, a CI run just failed on an indexing error when trying to look up teams with np.argmin(fitness), implying a difference in size between the teams and the fitness arrays at the time that's called.

So really, we need a better way to track fitness. We could potentially do what we've already thought about and make fitness an attribute of the Team class. We'd probably have to be careful to make sure this is only settable once, because all teams in the next generation are made as new instances of Team, so we don't want to accidentally overwrite a fitness by mistake instead of passing it to the correct new team.

Should be pretty easy to do!