darwinning
darwinning copied to clipboard
Add population reference to organism
What 🤔
- Add a reference to
population
toOrganism
and pass it down through each generation. - Set required minimum ruby version to 2.0 to ensure support for Keyword Arguments
Why 😃
Currently working on a project in which I load & cache data from a database in a Population
that is used in its organism's fitness
method. Letting organisms reference their population is a clean way to accomplish this, which may also be helpful in other use-cases. It may even provide a means to get around the limitation brought up in https://github.com/dorkrawk/darwinning/issues/17 in some cases.
This seems to couple the config with population, organism, and reproduction.
Instead of passing the population around so much, could it be held at a higher level and injected when you need it?
@chadmetcalf What if the data you need to calculate fitness
of a member is specific to the population
instance of which it is a member? I see no way of injecting that data into each member (see also https://github.com/dorkrawk/darwinning/issues/17).