1) Which approach from the following approaches "a" and "b" is used while performing crossover?

a) By selecting any 2 parents randomly from selected population, crossing them, forming just TWO offsprings, adding them in population and throwing out just TWO least fit individuals.

Thus, here, the new generation will have just 2 new individuals? Rest all individuals will be old?

b) By selecting parents and forming offsprings equal to population size and replacing the entire old population with new one.

Thus, here , in new generation, all individuals will be the new offsprings that were generated by previous population?

2) Also, where will the crossover probability come into picture here?


Both (a) and (b) are valid options that appear in real algorithms. Option (a) is called a "steady state genetic algorithm" and option (b) a "generational genetic algorithm", though (b) is less likely to be referred to by a specific name, since it's more like the standard way of doing things.

Realistically, there are no "right" answers. There is almost a continuum of ways to do this kind of thing, with different points along that spectrum occasionally getting a name to refer to them (e.g., "elitism" is almost generational, but maybe you keep one or two of the best individuals from the parent population). Ultimately your job as a GA practitioner is to understand the implications of how you set these parameters so that you can choose effectively for a particular situation.

Crossover probability is just the probability that you perform the operator versus passing two parents down unmodified. Something like the following inside the core loop of your algorithm.

p1, p2 = select parents
if rand01() < crossover probability
    c1, c2 = crossover(p1, p2)
    c1, c2 = p1, p2
insert c1, c2 into child population
| cite | improve this answer | |
  • $\begingroup$ So, in approach "a", the new generation will have just 2 new individuals and rest all will be old? Is it valid to do this even for a large population? Will it not slow down the process of convergence? $\endgroup$ – Harshada Kelkar Aug 25 '18 at 0:56
  • $\begingroup$ Exactly. It's completely valid for any size population. If anything, you tend to hasten convergence because good solutions can become parents more quickly than in a strict generational model. It's important though to understand that there isn't a "correct" way to build a GA. You have understand your dynamics and fit your choices to the situation. $\endgroup$ – deong Aug 26 '18 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.