godatadriven / evol

a python grammar for evolutionary algorithms and heuristics
https://evol.rtfd.io
MIT License
187 stars 12 forks source link

Concept of elites #150

Closed mattc-eostar closed 4 years ago

mattc-eostar commented 4 years ago

I searched through the repo looking to see if there is a way to keep elites within the population untouched or accessible to make sure breeding using the top k elites to converge to a solution more quickly.

Is this possible with the current implementation? Thanks!

koaning commented 4 years ago

I believe this is what .survive(n=10) might do. That method allows for a percentage to survive as well as a number. Does this work or is there another aspect to being an 'elite'?

rogiervandergeer commented 4 years ago

I guess you may also want to prevent the elites from being mutated. We currently have no such functionality.

koaning commented 4 years ago

Technically ... you can get close. You just have to use the .breed() as a proxy for .mutate. You would mutate the parents and these would become the new members. This leaves the current parents untouched.

There are some other hacky things you could do, but these go against the API.