Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. COPart three is where I have the problem. I have my population and its genes, I have given them each a number that is either zero or one and I have a sum of the total fitness of the entire population. Do I now loop through the same thing again and if I do so what member do I select? To answer your latest question I am familiar with C, although at the moment I am just struggling with the fitness method; I have a pretty good idea of how I will handle the crossover and mutation.
      singulars
    2. COSorry, just took another look at your code. You've got each chromosome as an array of int, each of which is to be either 0 or 1. When I skimmed the first time, I assumed you were packing alleles as bits into a single integer, which would be more space-efficient. The fitness function represents your best guess as to how "good" an individual solution (=chromosome) is. My roulette wheel selection psuedocode assumes that fitness is to be maximized rather than minimized, but it's easily altered for the opposite. (To be continued...)
      singulars
    3. COYou would (after computing the total fitness---your current "fitness function" is that a chromosome's fitness is the sum of it's int array) loop back through your population. Here is a simple GA I have previously written as a demonstration in C: <a href="http://codepad.org/f8IJiCu1">http://codepad.org/f8IJiCu1</a>. It may help to see some code as the algorithm can be difficult to explain in writing. A similar Python version I wrote is at: <a href="http://codepad.org/8imFTytY">http://codepad.org/8imFTytY</a>. This is a little cleaner IMHO.
      singulars
 

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