# Genetic Algorithms in Elixir: Ch 4 portfolio example pp66

**URL:** <https://forum.devtalk.com/t/genetic-algorithms-in-elixir-ch-4-portfolio-example-pp66/3902>\
**Category:** PragProg Customers\
**Tags:** suggestion, book-genetic-algorithms-in-elixir\
**Created:** [10 November 2020 08:44 UTC](https://forum.devtalk.com/t/genetic-algorithms-in-elixir-ch-4-portfolio-example-pp66/3902 "2020-11-10T08:44:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Archer](https://forum.devtalk.com/user_avatar/forum.devtalk.com/archer/32/1174_2.png) [@Archer](https://forum.devtalk.com/u/Archer)\
**Post date:** [10 November 2020 22:01 UTC](https://forum.devtalk.com/t/genetic-algorithms-in-elixir-ch-4-portfolio-example-pp66/3902/2 "2020-11-10T22:01:55Z")

</div>

Also since genetic.ex is already doing the sort by fitness why not stick with  
def terminate?(population, \_generation, \_temperature),  
do: hd(population).fitness \> @target\_fitness

For me a portfolio with @target\_fitness 1600 was easily found with an age between 800-1100 on average.

also by this point in the book my _terminate?()_ callback specification has three arguments, but book only shows two (missing \_temperature).

---

_[View the full topic](https://forum.devtalk.com/t/genetic-algorithms-in-elixir-ch-4-portfolio-example-pp66/3902)._
