
gmlewis
Genetic Algorithms in Elixir: Some feedback, a question and suggestion
@seanmor5 - This is a great book so far… I’m enjoying reading and coding along with it!
Quick question, though - since “evaluate” goes to the trouble of calling the “fitness_function” and generating an updated list of Chromosomes with the new calculated “fitness” values in the struct, instead of ending the function with this (where it has to call the “fitness_function” a bunch more times):
|> Enum.sort_by(fitness_function, &>=/2)
why not end it with this (in order to use these pre-calculated values)?
|> Enum.sort_by(& &1.fitness, &>=/2)
Also, I’m kinda sad that you dismissed the tree-type genetic programming like John Koza did in the 60s and 70s (to generate electronic circuits and a whole bunch of other cool stuff), but that is a huge topic in itself. Also, I’m extremely interested in Gene Expression Programming invented by Dr. Candida Ferreira, but that is also tree-type.
Anyway, thanks for the great book, and I look forward to your updates!
– Glenn
Marked As Solved

seanmor5
Good catch! I think that’s the result of me forgetting to update the call to sort_by
after I added in the fitness calculation for each chromosome. I’ll make sure that gets fixed.
I thought a lot about whether or not to include some examples of Genetic Programing and other tree-type methods. Ultimately I thought it might have been a lot of overhead just to get a simple example up and running and I was trying to cover a lot of ground without getting too carried away with any one topic. I was also trying to make sure the topics built on top of one another and felt like a dive into tree-based encodings and their applications would have been too much of a detour from the progression of the book.
Now that you mention it I think a dive into tree-based encoding schemes would make for an excellent supplement to the book. I’ll put something together and release it on my blog for anybody who’s interested.
Also Liked

seanmor5
Thanks for the suggestion. It’s in my profile. Not much content…yet.

gmlewis
Awesome! Can you please provide a link to your blog? I don’t remember seeing it in the book (yet).
Also, just for kicks, you might enjoy checking out my early attempts of Gene Express Programming (in Go) from a few years back: GitHub - gmlewis/gep: Gene Expression Programming in Go
– Glenn

AstonJ
You could add it to your profile as well Sean
Popular Prag Prog topics










Other popular topics










Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /haskell
- /java
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /centos
- /ash
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /textmate
- /sublime-text
- /react-native
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /nodejs
- /lua
- /slackware
- /julia
- /c
- /neovim