How Does Elixir Fit In?
Genetic Algorithms in Elixir — by Sean Moriarity (8 / 101)
👈 How to Use This Book | TOC | Chapter 1 Writing Your First Genetic Algorithm 👉
Before you start reading this book, you’re likely wondering two things:
- Why would I do this in Elixir?
- How does Elixir fit in the bigger picture of genetic algorithm design?
Elixir is certainly not a popular choice for genetic algorithm design; however, that doesn’t mean it’s not a good choice.
First, the significant increases in available computing power over the last decade have meant the need for incredibly efficient code has diminished. That’s not to say you shouldn’t pay attention to efficiency and writing efficient code; however, the need to optimize code for low-power hardware has significantly decreased.
Second, as you’ll see in Chapter 11, Optimizing Your Algorithms, parallelism in Elixir is a straightforward task. The BEAM is especially optimized for running numerous processes at once, so writing and running parallel code is easy. Genetic algorithms are by nature very parallel. A portion of research[3] into genetic algorithms takes advantage of the parallelism offered by Erlang to experiment with parallel genetic algorithms.
Finally, Elixir’s syntax and design patterns lend themselves nicely to writing idiomatic genetic algorithms. As you’ll see throughout this book, Elixir offers a number of useful features for creating a general framework for genetic algorithm design. This is not only excellent for learning but also for rapid prototyping of new ideas.
You might not choose to implement a production-level genetic algorithm in Elixir, but using Elixir to prototype and experiment can save you significant amounts of time and effort.
Now, it’s time to get started writing your first genetic algorithm.
Footnotes
[1] https://elixirschool.com/en/
[2] https://elixir-lang.org/getting-started/introduction.html
[3] http://personal.denison.edu/~lalla/MCURCSM2011/6.pdf
Copyright © 2021, The Pragmatic Bookshelf.
👈 How to Use This Book | TOC | Chapter 1 Writing Your First Genetic Algorithm 👉
Genetic Algorithms in Elixir by Sean Moriarity can be purchased in other book formats directly from the Pragmatic Programmers. If you notice a code error or formatting mistake, please let us know here so that we can fix it.






