Answers.Body: <p>The mutation operation is (usually) needed to introduce new genes not found in the population.</p>
  
  <p>For example, suppose that you have 4 possible genes <span class="math-container">$A$</span>, <span class="math-container">$B$</span>, <span class="math-container">$C$</span>, and <span class="math-container">$D$</span>, and that your chromosomes have a non-binary encoding. In that case, if no member of your population has the gene <span class="math-container">$D$</span>, then no amount of crossover operations will result in the introduction of that gene.</p>
  
  <p>However, if your chromosomes use a binary encoding, then new genes could be introduced as a side effect of crossover operations. But it is always safer to have some kind of mutation to ensure that all genes can be accessed.</p>
  
  <p>See also the paper <a href="https://www.hindawi.com/journals/cin/2017/7430125/" rel="nofollow noreferrer">Genetic Algorithm for Traveling Salesman Problem with Modified Cycle Crossover Operator</a>, which mentions several non-binary encodings for the TSP.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-28T14:50:56.997Z
Answers.LastActivityDate: 2019-11-22T01:00:01.470Z
Answers.LastEditDate: 2019-11-22T01:00:01.470Z
Answers.UserDisplayName: Philippe Olivier
Answers.Body: <p>Mutation is used to maintain diversity in the solutions. Crossover alone cannot do this.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-15T13:52:52.163Z
Answers.Text: This might be correct, but you should provide more details about why that is the case, because it's not obvious why the cross-over alone doesn't introduce diversity. In fact, it does, but to what degree? The other answer actually provide an example of when the mutation could be useful, but you should also extend this answer to provide more details. Right now, this answer looks like a comment, so it should be converted to a comment.
Answers.UserDisplayName: nbro
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-08T19:22:37.693Z
Answers.LastActivityDate: 2018-12-08T19:22:37.693Z
Answers.UserDisplayName: William Scott
Body: <p>Why do we apply the mutation operation after generating the offspring, in genetic algorithms?</p>
  
Tags: <genetic-algorithms><evolutionary-algorithms><mutation-operators>
Title: Why do we apply the mutation operation after generating the offspring?
UserDisplayName: Nimra Malik
ThreadText: # Why do we apply the mutation operation after generating the offspring?
  
  (Asked by: username_0 on 2018-11-28)
  
  Why do we apply the mutation operation after generating the offspring, in genetic algorithms?
  
  **Tags:** genetic-algorithms, evolutionary-algorithms, mutation-operators
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-11-28. Score: 4
  
  The mutation operation is (usually) needed to introduce new genes not found in the population.
  
  For example, suppose that you have 4 possible genes $A$, $B$, $C$, and $D$, and that your chromosomes have a non-binary encoding. In that case, if no member of your population has the gene $D$, then no amount of crossover operations will result in the introduction of that gene.
  
  However, if your chromosomes use a binary encoding, then new genes could be introduced as a side effect of crossover operations. But it is always safer to have some kind of mutation to ensure that all genes can be accessed.
  
  See also the paper [Genetic Algorithm for Traveling Salesman Problem with Modified Cycle Crossover Operator](https://www.hindawi.com/journals/cin/2017/7430125/), which mentions several non-binary encodings for the TSP.
  
  
  ---
  
  ### Answer by username_2 on 2018-12-08. Score: 1
  
  Mutation is used to maintain diversity in the solutions. Crossover alone cannot do this.
  
  > **Comments:**
  > **username_3**: This might be correct, but you should provide more details about why that is the case, because it's not obvious why the cross-over alone doesn't introduce diversity. In fact, it does, but to what degree? The other answer actually provide an example of when the mutation could be useful, but you should also extend this answer to provide more details. Right now, this answer looks like a comment, so it should be converted to a comment.  
  
  ---
  
  