7 Genetic algorithms

 

This chapter covers

  • Introducing population-based optimization algorithms
  • Understanding evolutionary computation
  • Understanding the different components of genetic algorithms
  • Implementing genetic algorithms in Python

Suppose you’re on a treasure-hunting mission and you don’t want the risk of searching alone and returning empty-handed. You might decide to collaborate with a group of friends and share information. This approach follows a population-based search strategy, where multiple agents are involved in the search process.

During this collaborative effort, you may notice that some hunters perform better than others. In this case, you may choose to retain only the best-performing hunters and replace the less competent ones with new recruits. This process resembles the workings of evolutionary algorithms such as genetic algorithms, where the fittest individuals survive and pass on their traits to the next generation.

In this chapter, the binary-coded genetic algorithm is presented and discussed as an evolutionary computing algorithm. We’ll look at different elements of this algorithm and at the implementation details. Other variants of genetic algorithms, such as the gray-coded genetic algorithm, real-valued genetic algorithm, and permutation-based genetic algorithm will be discussed in the next chapter.

7.1 Population-based metaheuristic algorithms

7.2 Introducing evolutionary computation

7.2.1 A brief recap of biology fundamentals

7.2.2 The theory of evolution

7.2.3 Evolutionary computation

7.3 Genetic algorithm building blocks

7.3.1 Fitness function

7.3.2 Representation schemes

7.3.3 Selection operators

7.3.4 Reproduction operators

7.3.5 Survivor selection

7.4 Implementing genetic algorithms in Python

Summary