darwinning icon indicating copy to clipboard operation
darwinning copied to clipboard

Add population reference to organism

Open jbarrieault opened this issue 7 years ago • 2 comments

What 🤔

  • Add a reference to population to Organism 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.

jbarrieault avatar Dec 18 '17 15:12 jbarrieault

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 avatar Jan 30 '18 20:01 chadmetcalf

@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).

jbarrieault avatar Feb 07 '18 12:02 jbarrieault