Answers.Body: <p>It is not true that the number of solutions necessarily decreases during the selection phase (if by solutions you mean the number of individuals in the population). The number of solutions is usually constant, i.e., you can start with <span class="math-container">$N$</span> individuals, then, every iteration (or generation), you can e.g. select two individuals from the population (typically, the fittest ones, but you can have some more sophisticated selection criteria), then you merge them to create two new individuals (i.e. crossover), which will then replace (with a certain probability) the two least fit individuals from the current population, so the population's size remains constant.</p>
  <p>If you are talking about reaching a local minimum, i.e. none of the solutions in the population are &quot;good enough&quot;, then, as someone has already suggested, there are potentially multiple ways to address this issue, such as</p>
  <ul>
  <li>increase the population size</li>
  <li>run the genetic algorithm for a longer time (if you have the resources)</li>
  <li>change your genetic operators (i.e. the mutation and crossover) so that to introduce more diversity</li>
  <li>tweak the replacement, mutation, and crossover rates</li>
  <li>change your selection strategy (there are many selection strategies)</li>
  <li>make sure that the representation of the solutions is suitable (e.g. once, by mistake, I was using an array of integers rather than floating-point numbers, so I couldn't ever find the correct solution, which was an array of floating-point numbers)</li>
  <li>use something like <a href="http://people.idsia.ch/%7Etino/papers/cuccu.evostar11.pdf" rel="nofollow noreferrer">novelty search</a></li>
  </ul>
  <p>The correct approach will probably depend on the context.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-01T20:56:25.897Z
Answers.LastActivityDate: 2020-08-01T22:24:43.487Z
Answers.LastEditDate: 2020-08-01T22:24:43.487Z
Answers.UserDisplayName: nbro
Answers.Body: <p>There are multiple ways to interpret those steps. The most common standard approaches are</p>
  <ul>
  <li><p>select two parents and produce two offspring; repeat until child population is the same size as parent population, and let the children replace their parents unconditionally (generational GA)</p>
  </li>
  <li><p>same as the above, but allow a few parents to live on instead of a few children if the parents have higher fitness (elitism)</p>
  </li>
  <li><p>each iteration, select two parents, produce one child, let the child replace a member of the parent population if it is better (steady state GA)</p>
  </li>
  </ul>
  <p>But there are other ways to go. There's an algorithm called CHC that lets the child population get smaller over time, and when it reaches zero, the algorithm triggers a smart restart. The point is there's no single definition for what makes an evolutionary algorithm. It's up to you to decide how to make something that works well for your problem. When you're a beginner though, it's handy to start from known points, like the three I mentioned above.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-01T14:33:32.750Z
Answers.LastActivityDate: 2020-08-01T14:33:32.750Z
Answers.UserDisplayName: deong
Answers.Body: <p>This is a more complex question than it might initially seem. A genetic algorithm models a biological process,namely population genetics. No biological population evolves to a single cloned individual, a process in genetic algorithms referred to as premature convergence where the population converges to a single non optimal, though possibly locally optimal, solution. The avoidance of premature convergence or the maintenance of population diversity is an important aspect of the genetic model that is often not well addressed, and one that the five step model you detail definitely does not.</p>
  <p>The one operator that will maintain diversity is mutation, since it is a purely random operator. However, what the mutation rate should be is highly argued over. A general consensus is that if each chromosome is of length N then the mutation rate should be 1/N. Likewise, the consensus is that 60% of the population should be replaced in each breeding cycle.</p>
  <p>However, these settings do not emerge directly from biological reality and premature convergence remains problematic. A more realistic model is to reflect the fact that in biology resources are finite, and to adjust the fitness of individuals proportionate to the number of similar individuals on the assumption that similar individuals are chasing the same resource. The fitness landscape is thus dynamically warped by  the changing distribution of the population. You will still have to retain memory of the fittest solution before adjustment. A common solution is to apply cluster analysis to the population, reducing the individual’s fitness by the size of the cluster to which it is allotted. A seminal paper is by <a href="https://www.semanticscholar.org/paper/A-Fast-Genetic-Algorithm-with-Sharing-Scheme-Using-Yin-Germay/87e16bb2c15dbe699b84ef07722661c6acdff88e" rel="nofollow noreferrer">Yin and Germay A Fast Genetic Algorithm with Sharing Scheme Using Cluster Analysis Methods in Multimodal Function Optimization </a>`. The assumption is still made that the population is modelling a single biological species. How diversity does not merely maintain diversity but results in a population dividing into separate reproductively isolated species is a question for another day, and one that divides biologists to the current day.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-01T18:08:07.860Z
Answers.LastActivityDate: 2020-08-01T18:08:07.860Z
Answers.UserDisplayName: Nick
Body: <p>The genetic algorithm consists of 5 phases of which 4 are repeated:</p>
  <ol>
  <li>Initial population (initially)</li>
  <li>Fitness function</li>
  <li>Selection</li>
  <li>Crossover</li>
  <li>Mutation</li>
  </ol>
  <p>In the selection phase, the number of solutions decreases. How is it avoided to run out of the population before reaching a suitable solution?</p>
  
Tags: <genetic-algorithms><genetic-operators><selection-operators>
Title: How to avoid running out of solutions in genetic algorithm due to selection?
UserDisplayName: MScott
ThreadText: # How to avoid running out of solutions in genetic algorithm due to selection?
  
  (Asked by: username_0 on 2020-08-01)
  
  The genetic algorithm consists of 5 phases of which 4 are repeated:
  
  1. Initial population (initially)
  2. Fitness function
  3. Selection
  4. Crossover
  5. Mutation
  
  In the selection phase, the number of solutions decreases. How is it avoided to run out of the population before reaching a suitable solution?
  
  **Tags:** genetic-algorithms, genetic-operators, selection-operators
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2020-08-01. Score: 3
  
  It is not true that the number of solutions necessarily decreases during the selection phase (if by solutions you mean the number of individuals in the population). The number of solutions is usually constant, i.e., you can start with $N$ individuals, then, every iteration (or generation), you can e.g. select two individuals from the population (typically, the fittest ones, but you can have some more sophisticated selection criteria), then you merge them to create two new individuals (i.e. crossover), which will then replace (with a certain probability) the two least fit individuals from the current population, so the population's size remains constant.
  
  If you are talking about reaching a local minimum, i.e. none of the solutions in the population are "good enough", then, as someone has already suggested, there are potentially multiple ways to address this issue, such as
  
  * increase the population size
  * run the genetic algorithm for a longer time (if you have the resources)
  * change your genetic operators (i.e. the mutation and crossover) so that to introduce more diversity
  * tweak the replacement, mutation, and crossover rates
  * change your selection strategy (there are many selection strategies)
  * make sure that the representation of the solutions is suitable (e.g. once, by mistake, I was using an array of integers rather than floating-point numbers, so I couldn't ever find the correct solution, which was an array of floating-point numbers)
  * use something like [novelty search](http://people.idsia.ch/%7Etino/papers/cuccu.evostar11.pdf)
  
  The correct approach will probably depend on the context.
  
  
  ---
  
  ### Answer by username_2 on 2020-08-01. Score: 2
  
  There are multiple ways to interpret those steps. The most common standard approaches are
  
  * select two parents and produce two offspring; repeat until child population is the same size as parent population, and let the children replace their parents unconditionally (generational GA)
  * same as the above, but allow a few parents to live on instead of a few children if the parents have higher fitness (elitism)
  * each iteration, select two parents, produce one child, let the child replace a member of the parent population if it is better (steady state GA)
  
  But there are other ways to go. There's an algorithm called CHC that lets the child population get smaller over time, and when it reaches zero, the algorithm triggers a smart restart. The point is there's no single definition for what makes an evolutionary algorithm. It's up to you to decide how to make something that works well for your problem. When you're a beginner though, it's handy to start from known points, like the three I mentioned above.
  
  
  ---
  
  ### Answer by username_3 on 2020-08-01. Score: 1
  
  This is a more complex question than it might initially seem. A genetic algorithm models a biological process,namely population genetics. No biological population evolves to a single cloned individual, a process in genetic algorithms referred to as premature convergence where the population converges to a single non optimal, though possibly locally optimal, solution. The avoidance of premature convergence or the maintenance of population diversity is an important aspect of the genetic model that is often not well addressed, and one that the five step model you detail definitely does not.
  
  The one operator that will maintain diversity is mutation, since it is a purely random operator. However, what the mutation rate should be is highly argued over. A general consensus is that if each chromosome is of length N then the mutation rate should be 1/N. Likewise, the consensus is that 60% of the population should be replaced in each breeding cycle.
  
  However, these settings do not emerge directly from biological reality and premature convergence remains problematic. A more realistic model is to reflect the fact that in biology resources are finite, and to adjust the fitness of individuals proportionate to the number of similar individuals on the assumption that similar individuals are chasing the same resource. The fitness landscape is thus dynamically warped by the changing distribution of the population. You will still have to retain memory of the fittest solution before adjustment. A common solution is to apply cluster analysis to the population, reducing the individual’s fitness by the size of the cluster to which it is allotted. A seminal paper is by [Yin and Germay A Fast Genetic Algorithm with Sharing Scheme Using Cluster Analysis Methods in Multimodal Function Optimization](https://www.semanticscholar.org/paper/A-Fast-Genetic-Algorithm-with-Sharing-Scheme-Using-Yin-Germay/87e16bb2c15dbe699b84ef07722661c6acdff88e) `. The assumption is still made that the population is modelling a single biological species. How diversity does not merely maintain diversity but results in a population dividing into separate reproductively isolated species is a question for another day, and one that divides biologists to the current day.
  
  
  ---
  
  