Answers.Body: <p>As @Thomas W said, you can be pretty immaginative when you're developing mutation and crossover methods. Each problem has its own caracteristics and, therefore, requires a different strategy.</p>
  
  <p>BUT, from my experience, I'd say that 90% of crossovers and mutation on real numbers genotypes are solved using the BLX-α algorithm.  </p>
  
  <p><strong>Crossover:</strong></p>
  
  <p><a href="https://i.sstatic.net/RDKUw.png" rel="noreferrer"><img src="https://i.sstatic.net/RDKUw.png" alt="BlX-α algorithm range"></a></p>
  
  <p>This algorithm is really simple. Given the parents <em>X</em> and <em>Y</em> and an α value (inside the range [0,1], generally around 0.1/0.15, but it depends by the problem), For each gene of your genotype: </p>
  
  <ol>
  <li>extract the genes <em>xi</em> and <em>yi</em></li>
  <li>find the minimum and the maximum values</li>
  <li>the new gene will be a random number in the interval [min - range * α, max + range * α]</li>
  </ol>
  
  <p>A variation of this algorithm is the BLX-αβ, in which we take into account which parent performed better and use two constants (α > β) to increase the probabilities that the new value will be closer to the one of the fittest parent</p>
  
  <p><a href="https://i.sstatic.net/Wy65S.png" rel="noreferrer"><img src="https://i.sstatic.net/Wy65S.png" alt="BLX-αβ algorithm range"></a></p>
  
  <p><strong>Mutation:</strong></p>
  
  <p>With the mutation the situation is similar: we need to get a random value that is related to our problem domain (we do not want the mutations to be destructive! They have the function of <em>exploring</em> the space).<br>
  In these cases it is useful to determine a range for the mutation and use that range to find the new value of the gene using BLX-α.  </p>
  
  <p>A more sophisticated mutation algorithm can be achieved using BLX-α on boundaries that depend on the actual value of the gene and the fitness function of the individual.<br>
  Let's imagine that our individual performs in a very bad way; in that case the mutation operator will be used to <em>shift</em> the individual to a distant point in the search space, where it will probably perform better.<br>
  On the other hand, if the individual is already fit we may not want to introduce some dramatic changes using the mutation. In that case the mutation range would be more contained and would have the function of <em>tuning</em> the genotype instead of <em>exploring</em> for better alternatives.     </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-20T11:49:00.140Z
Answers.Text: Is it correct to say that with the BLX-α algorithm we can move to points outside the interval of the initial population? That is, assuming an 1d optimization problem, if the values for the initial population were in $[a, b]$, by applying the BLX-α we can move to a point in $[c, d]$ where $c > a$ and $d > b$?
Answers.UserDisplayName: Antonios Sarikas
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-22T07:07:12.037Z
Answers.Text: @adosar The whole point of the BLX-α crossover (and most of the crossover algorithms) is to produce a result that is in the range of the parents' genes. So, although the new range is an extended version of it [a-α, b+α], you still want to explore the local space, rather than displacing yourself in a different point. If you were to choose a high value for α, you might move away from the initial population interval, but that will probably be counterproductive, as genes of individuals that performed well won't be passed down easily to the next generation. Short answer: no :)
Answers.UserDisplayName: Alvin Sartor
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-23T19:47:01.797Z
Answers.Text: It is a tradeoff between exploration and exploitation I think. It is not bad idea per se to move away from the initial population. Of course, we should somehow exploit the ``strength" of the parent genes so we can't set a very large value of $\alpha$.
Answers.UserDisplayName: Antonios Sarikas
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-24T20:03:24.723Z
Answers.Text: @adosar yes you are correct. If what you care about is to diverge from the initial population, you can set an initially high α, that decreases over time. I don't really see the point of doing so though, you could simply spread it more when it is initially generated. After all, a good initial population is nicely spread over the whole exploration space
Answers.UserDisplayName: Alvin Sartor
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-09T14:21:49.913Z
Answers.LastActivityDate: 2018-05-13T14:37:15.177Z
Answers.LastEditDate: 2018-05-13T14:37:15.177Z
Answers.UserDisplayName: Alvin Sartor
Answers.Body: <p>You have a genome with certain genes:</p>
  
  <pre><code>genome = { GeneA: value, GeneB: value, GeneC: value }
  </code></pre>
  
  <p>So take for example:</p>
  
  <pre><code>genome = { GeneA: 1, GeneB: 2.5, GeneC: 3.4 }
  </code></pre>
  
  <p>A few examples of mutation could be:</p>
  
  <ul>
  <li>Switch around two genes: <code>{ GeneA: 1, GeneB: 3.4, GeneC: 2.5 }</code></li>
  <li>Add/substract a random value from a gene: <code>{ GeneA: 0.9, GeneB: 2.5, GeneC: 3.4 }</code></li>
  </ul>
  
  <p>Suppose you have two genomes:</p>
  
  <pre><code>genome1 = { GeneA: 1, GeneB: 2.5, GeneC: 3.4 }
  genome2 = { GeneA: 0.4, GeneB: 3.5, GeneC: 3.2 }
  </code></pre>
  
  <p>A few examples of crossover could be:</p>
  
  <ul>
  <li>Taking the average: <code>{ GeneA: 0.7, GeneB: 3.0, GeneC: 3.3 }</code></li>
  <li>Uniform (50% chance): <code>{ GeneA: 0.4, GeneB: 2.5, GeneC: 3.2 }</code></li>
  <li>N-point crossover: <code>{ GeneA: 1, | CROSSOVER POINT |  GeneB: 3.5, GeneC: 3.2 }</code></li>
  </ul>
  
  <hr>
  
  <p>You can be pretty imaginative when developing mutation and crossover methods.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2017-06-03T17:31:21.210Z
Answers.LastActivityDate: 2018-05-09T19:33:56.213Z
Answers.LastEditDate: 2018-05-09T19:33:56.213Z
Answers.UserDisplayName: Thomas Wagenaar
Body: <p>How exactly are "mutation" and "cross-over" applied in the context of a genetic algorithm based on real numbers (as opposed to just bits)? I think I understood how those two phases are applied in a "canonical" context where chromosomes are strings of bits of a fixed length, but I'm not able to find examples for other situations. What would those phases look like on the domain of real numbers?</p>
  
Tags: <genetic-algorithms><crossover-operators><mutation-operators><genetic-operators>
Title: How do mutation and crossover work with real-valued chromosomes?
UserDisplayName: danidemi
ThreadText: # How do mutation and crossover work with real-valued chromosomes?
  
  (Asked by: username_0 on 2017-06-03)
  
  How exactly are "mutation" and "cross-over" applied in the context of a genetic algorithm based on real numbers (as opposed to just bits)? I think I understood how those two phases are applied in a "canonical" context where chromosomes are strings of bits of a fixed length, but I'm not able to find examples for other situations. What would those phases look like on the domain of real numbers?
  
  **Tags:** genetic-algorithms, crossover-operators, mutation-operators, genetic-operators
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2017-06-03. Score: 7 | Accepted answer
  
  You have a genome with certain genes:
  
  ```
  genome = { GeneA: value, GeneB: value, GeneC: value }
  
  ```
  
  So take for example:
  
  ```
  genome = { GeneA: 1, GeneB: 2.5, GeneC: 3.4 }
  
  ```
  
  A few examples of mutation could be:
  
  * Switch around two genes: `{ GeneA: 1, GeneB: 3.4, GeneC: 2.5 }`
  * Add/substract a random value from a gene: `{ GeneA: 0.9, GeneB: 2.5, GeneC: 3.4 }`
  
  Suppose you have two genomes:
  
  ```
  genome1 = { GeneA: 1, GeneB: 2.5, GeneC: 3.4 }
  genome2 = { GeneA: 0.4, GeneB: 3.5, GeneC: 3.2 }
  
  ```
  
  A few examples of crossover could be:
  
  * Taking the average: `{ GeneA: 0.7, GeneB: 3.0, GeneC: 3.3 }`
  * Uniform (50% chance): `{ GeneA: 0.4, GeneB: 2.5, GeneC: 3.2 }`
  * N-point crossover: `{ GeneA: 1, | CROSSOVER POINT | GeneB: 3.5, GeneC: 3.2 }`
  
  ---
  
  You can be pretty imaginative when developing mutation and crossover methods.
  
  
  ---
  
  ### Answer by username_1 on 2018-05-09. Score: 8
  
  As @username_3 W said, you can be pretty immaginative when you're developing mutation and crossover methods. Each problem has its own caracteristics and, therefore, requires a different strategy.
  
  BUT, from my experience, I'd say that 90% of crossovers and mutation on real numbers genotypes are solved using the BLX-α algorithm.
  
  **Crossover:**
  
  [![BlX-α algorithm range](https://i.sstatic.net/RDKUw.png)](https://i.sstatic.net/RDKUw.png)
  
  This algorithm is really simple. Given the parents *X* and *Y* and an α value (inside the range [0,1], generally around 0.1/0.15, but it depends by the problem), For each gene of your genotype:
  
  1. extract the genes *xi* and *yi*
  2. find the minimum and the maximum values
  3. the new gene will be a random number in the interval [min - range \* α, max + range \* α]
  
  A variation of this algorithm is the BLX-αβ, in which we take into account which parent performed better and use two constants (α > β) to increase the probabilities that the new value will be closer to the one of the fittest parent
  
  [![BLX-αβ algorithm range](https://i.sstatic.net/Wy65S.png)](https://i.sstatic.net/Wy65S.png)
  
  **Mutation:**
  
  With the mutation the situation is similar: we need to get a random value that is related to our problem domain (we do not want the mutations to be destructive! They have the function of *exploring* the space).  
  In these cases it is useful to determine a range for the mutation and use that range to find the new value of the gene using BLX-α.
  
  A more sophisticated mutation algorithm can be achieved using BLX-α on boundaries that depend on the actual value of the gene and the fitness function of the individual.  
  Let's imagine that our individual performs in a very bad way; in that case the mutation operator will be used to *shift* the individual to a distant point in the search space, where it will probably perform better.  
  On the other hand, if the individual is already fit we may not want to introduce some dramatic changes using the mutation. In that case the mutation range would be more contained and would have the function of *tuning* the genotype instead of *exploring* for better alternatives.
  
  > **Comments:**
  > **username_2**: Is it correct to say that with the BLX-α algorithm we can move to points outside the interval of the initial population? That is, assuming an 1d optimization problem, if the values for the initial population were in $[a, b]$, by applying the BLX-α we can move to a point in $[c, d]$ where $c > a$ and $d > b$?  
  > **username_1**: @adosar The whole point of the BLX-α crossover (and most of the crossover algorithms) is to produce a result that is in the range of the parents' genes. So, although the new range is an extended version of it [a-α, b+α], you still want to explore the local space, rather than displacing yourself in a different point. If you were to choose a high value for α, you might move away from the initial population interval, but that will probably be counterproductive, as genes of individuals that performed well won't be passed down easily to the next generation. Short answer: no :)  
  > **username_2**: It is a tradeoff between exploration and exploitation I think. It is not bad idea per se to move away from the initial population. Of course, we should somehow exploit the ``strength" of the parent genes so we can't set a very large value of $\alpha$.  
  > **username_1**: @adosar yes you are correct. If what you care about is to diverge from the initial population, you can set an initially high α, that decreases over time. I don't really see the point of doing so though, you could simply spread it more when it is initially generated. After all, a good initial population is nicely spread over the whole exploration space  
  
  ---
  
  