title: Python DEAP, how to stop the evolution when the fitness doesn't increase after X generations?
body: <p>I want to stop the genetic algorithm when the fitness doesn't increase.</p>
  
  <p>I'm using the DEAP library in python.</p>
  
  <p>Typically, I have the following log file:</p>
  
  <pre><code>    gen nevals  mean        max     
      0   100 0.352431    0.578592
      1   83  -0.533964   0.719633
      2   82  -0.567494   0.719633
      3   81  -0.396759   0.751318
      4   74  -0.340427   0.87888
      5   80  -0.29756    0.888443
      6   86  -0.509486   0.907789
      7   85  -0.335586   1.06199
      8   69  -0.23967    1.12339
      9   73  -0.10727    1.20622
      10  88  -0.181696   1.20622
      11  77  -0.188449   1.20622
      12  72  0.135398    1.25254
      13  67  0.0304611   1.26931
      14  74  -0.0436463  1.3181
      15  70  0.289306    1.37582
      16  79  -0.0441134  1.37151
      17  73  0.339611    1.37204
      18  68  -0.137938   1.37204
      19  76  0.000527522 1.40034
      20  84  0.198005    1.40078
      21  69  0.243705    1.4306
      22  74  0.11812 1.4306
      23  83  0.16235 1.4306
      24  82  0.270455    1.43492
      25  76  -0.200259   1.43492
      26  77  0.157181    1.43492
      27  74  0.210868    1.43492
  </code></pre>
  
  <p>I initially set ngen = 200, but as you can see, the fitness function achieve a local maximum at 22th generation. So I want to stop the genetic algorithm when this happens.</p>