Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It is not possible to find parents if you do not know the inverse-crossover function (so that AxB => (a,b) &amp; (any a) => (A,B)). </p> <p>Usually the 1-point crossover function is:</p> <pre><code>a = A1 + B2 b = B1 + A2 </code></pre> <p>Even if you know <em>a</em> and <em>b</em> you <strong>cannot solve</strong> the system (system of 2 equations with 4 variables).</p> <p>If you know any 2 parts of any A or/and B then it <strong>can be solved</strong> (system of 2 equations with 2 variables). This is the case for your question as you provide both A and B.</p> <p>Generally crossover function does not have inverse function and you just need to find the solution logically or, <strong>if you know parents, perform the crossover and compare</strong>.</p> <p>So to make a generic formula for you we should know 2 things:</p> <ol> <li>Crossover function.</li> <li>Inverse-crossover function.</li> </ol> <p>The 2nd one is not usually used in GAs as it is not required. </p> <hr> <p>Now, I'll just answer your questions.</p> <blockquote> <p>Q1: In a genetic algorithm given the two parents A and B with the chromosomes 001110 and 101101, respectively, which of the following offspring could have resulted from a one-point crossover?</p> </blockquote> <p>Looking at the <em>a</em> and <em>b</em> I can see the crossover point is here:</p> <pre><code> 1 2 A: 00 | 1110 B: 10 | 1101 </code></pre> <p>Usually the crossover is done using <strong>this formula</strong>:</p> <pre><code>a = A1 + B2 b = B1 + A2 </code></pre> <p>so that possible children are:</p> <pre><code>a: 00 | 1101 b: 10 | 1110 </code></pre> <p>which excludes option b from the question.<br> <strong>So the answer to Q1 is the result child is a: 001101 assuming given <em>crossover function</em></strong></p> <blockquote> <p>Q2: Which of the above offspring could have resulted from a two-point crossover? and why?</p> </blockquote> <p>Looking at the a and b I can see the crossover points can be here:</p> <pre><code> 1 2 3 A: 00 | 11 | 10 B: 10 | 11 | 01 </code></pre> <p>Usual <strong>formula</strong> for 2-point crossover is:</p> <pre><code>a = A1 + B2 + A3 b = B1 + A2 + B3 </code></pre> <p>So the children would be:</p> <pre><code>a = 00 | 11 | 10 b = 10 | 11 | 01 </code></pre> <p>Comparing them to the options you asked (small <em>a</em> and <em>b</em>) we can say the answer:</p> <p><strong>Q2. A:</strong> <strong>Neither of <em>a</em> or <em>b</em> could be result of 2-point crossover with <em>AxB</em> <em>according to the given crossover function</em>.</strong> </p> <hr> <p>Again it is <strong>not possible</strong> to answer your questions without knowing the <strong>crossover function</strong>.</p> <p>The functions I provided are common in GA, but you can invent so many of them so they could answer the question (see the comment below):</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload