Elixir#
Algorithms#
From finance to artificial intelligence, genetic algorithms are a powerful tool with a wide array of applications. But you don't need an exotic new language or framework to get started; you can learn about genetic algorithms in a language you're already familiar with. Join us for an in-depth look at the algorithms, techniques, and methods that go into writing a genetic algorithm. From introductory problems to real-world applications, you'll learn the underlying principles of problem solving using genetic algorithms.
Evolutionary algorithms are a unique and often overlooked subset of machine learning and artificial intelligence. Because of this, most of the available resources are outdated or too academic in nature, and none of them are made with Elixir programmers in mind.
Start from the ground up with genetic algorithms in a language you are familiar with. Discover the power of genetic algorithms through simple solutions to challenging problems. Use Elixir features to write genetic algorithms that are concise and idiomatic. Learn the complete life cycle of solving a problem using genetic algorithms. Understand the different techniques and fine-tuning required to solve a wide array of problems. Plan, test, analyze, and visualize your genetic algorithms with real-world applications.
Open your eyes to a unique and powerful field - without having to learn a new language or framework.
What You Need:
You'll need a macOS, Windows, or Linux distribution with an up-to-date Elixir installation.
This book is for programmers with some experience or familiarity working with Elixir, who are looking to expand their knowledge into the field of genetic algorithms. While not traditionally thought of as a language suited for computationally expensive problems, Elixir’s simple syntax and functional style make for the creation of idiomatic solutions to optimization problems with genetic algorithms. These solutions gently introduce the user to genetic algorithms and optimization problems without the overhead of learning a completely new programming language. If you have no experience with Elixir, you might find this book difficult to follow at times. Before getting started, I recommend checking out Elixir School or the Elixir Guides to get some familiarity with the language.
How to use this book
Each chapter in this book builds on the last by making additions to a genetic algorithm framework in some meaningful way. You should read this book in successive order and follow along with the code examples as they are presented to you. If, for some reason, you want to skip around, you can download the code from each chapter on the book’s web page.
How does Elixir fit in?
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 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.