Answers.Body: <p>GAs are really a framework around a bunch of closely related ideas that can be tweaked in slightly different ways, and there's no good way to know what the authors intended aside from asking them or maybe finding an errata listing somewhere.</p>
  <p>That said, I think your assumption is correct. I think the pseudocode is probably not saying exactly what they intended it to say, and the textual description is the correct one.</p>
  <p>Generally, we'd implement this as</p>
  <pre><code>child &lt;- REPRODUCE(parent1, parent2)
  for each bit in child
      if random() &lt; mutation rate
          flip bit
  </code></pre>
  <p>as you suspected.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-18T07:55:00.583Z
Answers.Text: Agree. Also, a good place to check what is "standard practice" is the [microbial GA](https://users.sussex.ac.uk/~inmanh/MicrobialGA_ECAL2009.pdf), which agrees with this too.
Answers.UserDisplayName: maxy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-16T17:10:59.477Z
Answers.LastActivityDate: 2022-10-16T17:10:59.477Z
Answers.UserDisplayName: deong
Body: <p><a href="https://i.sstatic.net/62szW.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/62szW.jpg" alt="enter image description here" /></a></p>
  <p>With regards to the highlighted line, the authors earlier stated that:</p>
  <blockquote>
  <p>The mutation rate, which determines how often offspring have random mutations to
  their representation. Once an offspring has been generated, every bit in its composition
  is flipped with probability equal to the mutation rate.</p>
  </blockquote>
  <p>Doesn't this contradict the highlighted line in the code? Because according to this quote we mutate the children with the small probability called mutation rate every time they are generated so the actual code in my opinion should be:</p>
  <pre><code>for each bit in child string
      if (small random probability &gt;= mutation rate) mutate bit
  </code></pre>
  <p>instead of:</p>
  <pre><code> if (small random probability) mutate(child)
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-10-17T01:02:28.103Z
Comments.Text: Please don't upload code as images, use > . Images are not searchable for the text that they contain. Thanks.
Comments.UserDisplayName: Rob
Tags: <genetic-algorithms><norvig-russell>
Title: AIMA, Mutation in Genetic Algorithm
UserDisplayName: learner
ThreadText: # AIMA, Mutation in Genetic Algorithm
  
  (Asked by: username_0 on 2022-10-16)
  
  [![enter image description here](https://i.sstatic.net/62szW.jpg)](https://i.sstatic.net/62szW.jpg)
  
  With regards to the highlighted line, the authors earlier stated that:
  
  > The mutation rate, which determines how often offspring have random mutations to
  > their representation. Once an offspring has been generated, every bit in its composition
  > is flipped with probability equal to the mutation rate.
  
  Doesn't this contradict the highlighted line in the code? Because according to this quote we mutate the children with the small probability called mutation rate every time they are generated so the actual code in my opinion should be:
  
  ```
  for each bit in child string
      if (small random probability >= mutation rate) mutate bit
  
  ```
  
  instead of:
  
  ```
   if (small random probability) mutate(child)
  
  ```
  
  **Tags:** genetic-algorithms, norvig-russell
  
  > **Comments:**
  > **username_1**: Please don't upload code as images, use > . Images are not searchable for the text that they contain. Thanks.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-10-16. Score: 2 | Accepted answer
  
  GAs are really a framework around a bunch of closely related ideas that can be tweaked in slightly different ways, and there's no good way to know what the authors intended aside from asking them or maybe finding an errata listing somewhere.
  
  That said, I think your assumption is correct. I think the pseudocode is probably not saying exactly what they intended it to say, and the textual description is the correct one.
  
  Generally, we'd implement this as
  
  ```
  child <- REPRODUCE(parent1, parent2)
  for each bit in child
      if random() < mutation rate
          flip bit
  
  ```
  
  as you suspected.
  
  > **Comments:**
  > **username_3**: Agree. Also, a good place to check what is "standard practice" is the [microbial GA](https://users.sussex.ac.uk/~inmanh/MicrobialGA_ECAL2009.pdf), which agrees with this too.  
  
  ---
  
  