daffidwilde / edo

A library for generating artificial datasets through genetic evolution.
https://doi.org/10.1007/s10489-019-01592-4
MIT License
13 stars 0 forks source link

Should individuals have their own class? #116

Closed daffidwilde closed 5 years ago

daffidwilde commented 5 years ago

Individuals are currently stored as a collections.namedtuple but it could be beneficial to move to having an Individual class so that the fitness of an individual can be stored as an attribute. This sort of behaviour can be done with a namedtuple but requires a new instance of an individual be made once the fitness is evaluated. Not preferable.

The alternative would be to use functools.lru_cache or similar to store the fitness in memory elsewhere. This could also be potentially useful when assessing an individual which has turned up before (though unlikely to happen).

daffidwilde commented 5 years ago

Ended up creating this class (see a4ea3fc) as part of the refactor addressing #84 (see 562715b).