Genetic Algorithms in Elixir

Book description

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.

Publisher resources

View/Submit Errata

Table of contents

  1.  Disclaimer
  2.  Acknowledgments
  3.  Preface
    1. Who This Book Is For
    2. What’s in This Book
    3. How to Use This Book
    4. How Does Elixir Fit In?
  4. 1. Writing Your First Genetic Algorithm
    1. Understanding Genetic Algorithms
    2. Introducing the One-Max Problem
    3. Initializing the Population
    4. Understanding the Flow of Genetic Algorithms
    5. Selecting Parents
    6. Creating Children
    7. Running Your Solution
    8. Adding Mutation
    9. What You Learned
  5. 2. Breaking Down Genetic Algorithms
    1. Reviewing Genetic Algorithms
    2. Looking Deeper into Genetic Algorithms
    3. Using Mix to Write Genetic Algorithms
    4. Building a Framework for Genetic Algorithms
    5. Understanding Hyperparameters
    6. Solving the One-Max Problem Again
    7. What You Learned
  6. 3. Encoding Problems and Solutions
    1. Using Structs to Represent Chromosomes
    2. Using Behaviours to Model Problems
    3. Understanding and Choosing Genotypes
    4. Solving One-Max for the Last Time
    5. Spelling Words with Genetic Algorithms
    6. What You Learned
  7. 4. Evaluating Solutions and Populations
    1. Optimizing Cargo Loads
    2. Introducing Penalty Functions
    3. Applying a Penalty to the Shipping Problem
    4. Defining Termination Criteria
    5. Applying Termination Criteria to Shipping
    6. Crafting Fitness Functions
    7. Exploring Different Types of Optimization
    8. What You Learned
  8. 5. Selecting the Best
    1. Exploring Selection
    2. Customizing Selection in Your Framework
    3. Implementing Common Selection Strategies
    4. What You Learned
  9. 6. Generating New Solutions
    1. Introducing N-Queens
    2. Solving N-Queens with Order-One Crossover
    3. Exploring Crossover
    4. Implementing Other Common Crossover Strategies
    5. Crossing Over More Than Two Parents
    6. Implementing Chromosome Repairment
    7. What You Learned
  10. 7. Preventing Premature Convergence
    1. Breaking Codes with Genetic Algorithms
    2. Understanding Mutation
    3. Customizing Mutation in Your Framework
    4. Implementing Common Mutation Strategies
    5. Other Methods to Combat Convergence
    6. What You Learned
  11. 8. Replacing and Transitioning
    1. Creating a Class Schedule
    2. Understanding Reinsertion
    3. Experimenting with Reinsertion
    4. Growing and Shrinking Populations
    5. Local Versus Global Reinsertion
    6. What You Learned
  12. 9. Tracking Genetic Algorithms
    1. Using Genetic Algorithms to Simulate Evolution
    2. Logging Statistics Using ETS
    3. Tracking Genealogy in a Genealogy Tree
    4. What You Learned
  13. 10. Visualizing the Results
    1. Visualizing the Genealogy of the Tiger Evolution
    2. Visualizing Basic Statistics
    3. Playing Tetris with Genetic Algorithms
    4. Installing and Compiling ALEx
    5. What You Learned
  14. 11. Optimizing Your Algorithms
    1. Benchmarking and Profiling Genetic Algorithms
    2. Writing Fast Elixir
    3. Improving Performance with Parallelization
    4. Improving Performance with NIFs
    5. What You Learned
  15. 12. Writing Tests and Code Quality
    1. Understanding Randomness
    2. Writing Property Tests with ExUnit
    3. Cleaning Up Your Framework
    4. Writing Type Specifications
    5. What You Learned
  16. 13. Moving Forward
    1. Learning with Evolution
    2. Designing with Evolution
    3. Trading with Evolution
    4. Networking with Evolution
    5. Evolving Neural Networks
    6. Where to Go Next
  17.  Bibliography

Product information

  • Title: Genetic Algorithms in Elixir
  • Author(s): Sean Moriarity
  • Release date: January 2021
  • Publisher(s): Pragmatic Bookshelf
  • ISBN: 9781680508307