Intelligence through evolution
Tags: algorithms, watercooler, beginners
Published: 2021-08-09 12:56:01

When we look at the world around us, we sometimes wonder how everything we see and interact with came to be. One way to explain this is the theory of evolution. And it's useful in solving computational problems in AI.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0504m0qackblg9d2y21w.jpg)

The theory of evolution suggests that the living organisms that we see today did not suddenly exist that way, but evolved through millions of years of subtle changes, with each generation adapting to its environment.

This implies that the physical and cognitive characteristics of each living organism are a result of best fitting to its environment for survival. Organisms evolve through reproduction by producing children of mixed genes from their parents.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ojj9x729a3aippqtl57p.jpg)

Given the fitness of these individuals in their environment, stronger individuals have a higher likelihood of survival. We often make the mistake of thinking that evolution is a linear process, with clear changes in successors.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yut9rkx4ch6oyd1da4m0.jpg)

In reality, evolution is far more chaotic. A multitude of variants of species are created through mixing of genes. Noticeable differences in a species could take thousands of years, and only be realized by comparing the average individual in each of the time points.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/11tldlcta4vjbz4ejvhu.jpg)

Charles Darwin proposed natural selection. The concept that stronger members of a population are more likely to survive due to being more fit for their environment, which means they reproduce more and carry traits that are beneficial to survival to future generations.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ncfg7bc5f05wkaoae56d.jpg)

A classic example of evolution for adaption is the peppered moth. The peppered moth was originally light in color, which made for good camouflage against predators as the moth could blend in with light-colored surfaces in its environment.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u8w5ag1xervb1xjnc9k4.jpg)

Only around 2% of the moth population was darker in color. After the Industrial Revolution, around 95% of the species were of the darker color variant.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7z9jrw4ob847de0c663y.jpg)

One explanation is that the lighter-colored moths could not blend in with as many surfaces anymore because pollution had darkened surfaces; thus lighter-colored moths were eaten more by predators because those moths were more visible.

This theory is harnessed in algorithms like genetic algorithms. A solution is represented as a data structure, measured, and mixed with other solutions within certain rules. This repeats for many generations, and sometimes finds great solutions with less computational overhead.

If you want more details about this algorithm, see Grokking Artificial Intelligence Algorithms with Manning Publications: [http://bit.ly/gaia-book](http://bit.ly/gaia-book), consider following me - [@RishalHurbans](https://twitter.com/RishalHurbans), or join my mailing list for infrequent knowledge drops in your inbox: [https://rhurbans.com/subscribe](https://rhurbans.com/subscribe).