Implementing Reinsertion Strategies

Learn about different reinsertion strategies along with their implementations.

Pure reinsertion

Pure reinsertion is the type of reinsertion we used in the first few chapters of this course. Every chromosome in the old population is replaced with an offspring of the new population. With pure reinsertion, we can either treat mutants as offspring, which is fairly common, or ensure the selection rate and your mutation rate add to 1. Another option is to simply have a selection rate of 1 and mutate children.

Pure reinsertion is a type of generational replacement which refers to the process of creating an entirely new population so that there’s no overlap between populations. Technically, in a generational replacement strategy, the offspring directly replaces parents.

We’re likely to encounter two derivatives of generational replacement when working with genetic algorithms. They are μ+λ, read “mu plus lambda” and μ,λ, read “mu comma lambda.” In μ+λ replacement, a child competes with its parent for survival, the winner being the one with the larger fitness. In μ,λ replacement, more children than the required population size are created, and the best children survive. We might also see μ,λ replacement referred to as fitness-based insertion.

Given parents, offspring, and leftovers, we can implement pure reinsertion like this:

Get hands-on with 1200+ tech skills courses.