Answers.Body: <p>The typical way you'll see a GA measured is that an algorithm with a population size of <span class="math-container">$N$</span> is ran <span class="math-container">$K$</span> times from new random seeds each time. That gives you <span class="math-container">$K$</span> total runs of the algorithm, each of which, at the end, had a final population of <span class="math-container">$N$</span> individuals. If you take the best of those <span class="math-container">$N$</span> from each run, you get <span class="math-container">$K$</span> &quot;best&quot; solutions found. The average fitness value of those <span class="math-container">$K$</span> solutions is your MBF.</p>
  <p>AES here refers to the number of evaluations of the objective function the algorithm required. The reason for this is to provide a standardized amount of computation budget each algorithm used. Imagine if you compared algorithms on the basis of how many generations it took to find a good solution. In that case, I could just increase the population size of my algorithm by 100-fold or 1000-fold, and I'll probably look better. Same number of generations, but I gave my algorithm far more chances to find something good. Suppose I use wall-clock time. Now my algorithm might look better than yours just because I ran it on a much more powerful computer than you did.</p>
  <p>The insight to make here is that GAs work by evaluating new search points. Let's just count how many times that happens. You can run a larger population for a shorter number of generations, or you can allocate the same amount of computation to running a longer time with fewer points each generation. What matters is just how many fitness function evaluations you exhausted in finding the answer.</p>
  <p>For sudoku, you might have a fitness function that counted the number of rows, columns, or blocks that don't contain the correct digits of 1-9 and you minimize that function. You run your algorithm <span class="math-container">$K$</span> times from random seeds, and for each run, you record how many times you had to evaluate that fitness function before you found a <span class="math-container">$0$</span> (i.e., the puzzle was successfully solved). Average all <span class="math-container">$K$</span> of those counts, and that's your AES.</p>
  <p>Generalizing a bit, you might calculate average evaluations to find some &quot;good enough&quot; solution, but the general concept is the same.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-19T12:42:33.973Z
Answers.Text: So, a run is when I do Tournament selection, One point crossover, Random resetting, Age based replacement with elitism, isn't it? I'm having problems understanding the meaning of run. I do all of those steps, and I use the offspring I got as the population of s new execution algorithm. And I do this G times. Do I need to get the best fitness G times, and then get the mean value?
Answers.UserDisplayName: VansFannel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-20T13:50:11.550Z
Answers.Text: By a "run", I mean a complete test of your GA. You choose parameters for each test -- tournament selection, 1x crossover, bitwise mutation with probability p, population size of 100, etc. One of those parameters has to be a stopping condition of some sort. Do you run for 500 generations? Do you run until you solve the puzzle? Whatever. At some point, your algorithm terminates. That whole process from initial random population until it terminates is one "run".
Answers.UserDisplayName: deong
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-18T18:04:14.987Z
Answers.LastActivityDate: 2021-01-30T21:45:54.160Z
Answers.LastEditDate: 2021-01-30T21:45:54.160Z
Answers.UserDisplayName: deong
Body: <p>I've just started to learn genetic algorithms and I have found these measurements of runs that I don't understand:</p>
  <blockquote>
  <p>MBF: The mean best fitness measure (MBF) is the average of the best
  fitness values over all runs.</p>
  </blockquote>
  <blockquote>
  <p>AES: The average number of evaluation to solution.</p>
  </blockquote>
  <p>I have an initial random population. To evolve a population I do:</p>
  <ol>
  <li>Tournament selection</li>
  <li>One point crossover.</li>
  <li>Random resetting.</li>
  <li>Age based replacement with elitism (I replace the population with all offsprings generated).</li>
  <li>If I have generated G generations (in other words, I have repeated these four points G times) or I have found the solution, the algorithm ends, otherwise, it comes back to point 1.</li>
  </ol>
  <p>Is the mean of the best fitness the mean fitness of all of each generations (G best fitness)?</p>
  <pre><code>MBF = (BestFitness_0 + ... + BestFitness_G) / G
  </code></pre>
  <p>I'm not English and I don't understand the meaning of &quot;run&quot; here.</p>
  
Tags: <terminology><genetic-algorithms><fitness-functions>
Title: How can I calculate the "mean best fitness" measure in genetic algorithms?
UserDisplayName: VansFannel
ThreadText: # How can I calculate the "mean best fitness" measure in genetic algorithms?
  
  (Asked by: username_0 on 2018-07-18)
  
  I've just started to learn genetic algorithms and I have found these measurements of runs that I don't understand:
  
  > MBF: The mean best fitness measure (MBF) is the average of the best
  > fitness values over all runs.
  
  > AES: The average number of evaluation to solution.
  
  I have an initial random population. To evolve a population I do:
  
  1. Tournament selection
  2. One point crossover.
  3. Random resetting.
  4. Age based replacement with elitism (I replace the population with all offsprings generated).
  5. If I have generated G generations (in other words, I have repeated these four points G times) or I have found the solution, the algorithm ends, otherwise, it comes back to point 1.
  
  Is the mean of the best fitness the mean fitness of all of each generations (G best fitness)?
  
  ```
  MBF = (BestFitness_0 + ... + BestFitness_G) / G
  
  ```
  
  I'm not English and I don't understand the meaning of "run" here.
  
  **Tags:** terminology, genetic-algorithms, fitness-functions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-07-18. Score: 2 | Accepted answer
  
  The typical way you'll see a GA measured is that an algorithm with a population size of $N$ is ran $K$ times from new random seeds each time. That gives you $K$ total runs of the algorithm, each of which, at the end, had a final population of $N$ individuals. If you take the best of those $N$ from each run, you get $K$ "best" solutions found. The average fitness value of those $K$ solutions is your MBF.
  
  AES here refers to the number of evaluations of the objective function the algorithm required. The reason for this is to provide a standardized amount of computation budget each algorithm used. Imagine if you compared algorithms on the basis of how many generations it took to find a good solution. In that case, I could just increase the population size of my algorithm by 100-fold or 1000-fold, and I'll probably look better. Same number of generations, but I gave my algorithm far more chances to find something good. Suppose I use wall-clock time. Now my algorithm might look better than yours just because I ran it on a much more powerful computer than you did.
  
  The insight to make here is that GAs work by evaluating new search points. Let's just count how many times that happens. You can run a larger population for a shorter number of generations, or you can allocate the same amount of computation to running a longer time with fewer points each generation. What matters is just how many fitness function evaluations you exhausted in finding the answer.
  
  For sudoku, you might have a fitness function that counted the number of rows, columns, or blocks that don't contain the correct digits of 1-9 and you minimize that function. You run your algorithm $K$ times from random seeds, and for each run, you record how many times you had to evaluate that fitness function before you found a $0$ (i.e., the puzzle was successfully solved). Average all $K$ of those counts, and that's your AES.
  
  Generalizing a bit, you might calculate average evaluations to find some "good enough" solution, but the general concept is the same.
  
  > **Comments:**
  > **username_0**: So, a run is when I do Tournament selection, One point crossover, Random resetting, Age based replacement with elitism, isn't it? I'm having problems understanding the meaning of run. I do all of those steps, and I use the offspring I got as the population of s new execution algorithm. And I do this G times. Do I need to get the best fitness G times, and then get the mean value?  
  > **username_1**: By a "run", I mean a complete test of your GA. You choose parameters for each test -- tournament selection, 1x crossover, bitwise mutation with probability p, population size of 100, etc. One of those parameters has to be a stopping condition of some sort. Do you run for 500 generations? Do you run until you solve the puzzle? Whatever. At some point, your algorithm terminates. That whole process from initial random population until it terminates is one "run".  
  
  ---
  
  