Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm not familiar with with PyEvolve, but from what I can recall about Genetic algorithms, you are concerned with 4 steps,</p> <ol> <li>Chormosome Evalutation (you probably already have this figured out)</li> <li>Chromosome Initialization</li> <li>Chromosome Crossover</li> <li>Chromosome Mutation</li> </ol> <p>I think you can do this with lists just fine. You'll need to overload some operators, but it looks like PyEvolve <a href="http://pyevolve.sourceforge.net/getstarted.html#extending-pyevolve" rel="nofollow noreferrer">lets you do this</a> A simple thing would be to keep the list representation, just sort them numerically before you return the chromosome. </p> <p>I would need to know more about your problem, but here are my suggestions. Since you have a variable number of parameters, you need to come up with some sort of probability distribution for number of parameters in a chromosome. I'll assume a uniform random on 1,2,3,4 here, but you can try something else if you like that better. I'm going to call this distribution P_n.</p> <ol start="2"> <li>Initialization. Seed your population with (at least) 3000 chromosomes. Call these c_1,...,c_3000. Draw n_j from P_n. put j into c_j. Choose the remaining n_j - 1 parameters with a uniform random distribution from the remaining parameters.</li> <li>Crossover. Lets suppose that we have two chromosomes. C_1 and C_2. We're going to create (and return) chromosome C_3. Choose n_3 from {n_1, n_2} each with probability 1/2. Now put the parameters of C_1 and C_2 into one list (and unique them, so if <em>both</em> C_1 and C_2 contain parameter 1, it is only in the list once). Draw n_3 parameters from the joint list and put them into chromosome C_3.</li> <li>Mutation. Given Chromosome C_1, draw n_1* from P_n. if n_1* is &lt; n_1, randomly delete elements from C_1 until has n_1* elements. If n_1* = n_1 randomly choose 1 element from C_1 and replace it with a parameter randomly chosen from those not in C_1. If n_1* > n_1 randomly add elements to C_1 until is has size n_1*.</li> </ol> <p>Now, there are many ways to go about this, so do what makes the most sense for your problem.</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