The concept of genetic algorithm

Monkey evolution

Insert picture description here
Imagine that our ancestors are such a group of monkeys that have been on the tree. One day they gave birth to a monkey who always liked to stay on the ground, probably because of some mutation. Because he always liked to be on the ground, there were many rocks on the ground, he Begin to use stones as their own tools, such as smashing hard fruits or making weapons. Monkeys who can use stones become easier to eat than other monkeys, and are more capable of resisting outsiders. So the longer such monkeys live, they will reproduce The more we get. So our ancestors slowly become monkeys on the ground. We are one step closer to becoming humans. We see the lines above, and we can summarize the whole process.

Population evolution

Insert picture description here
First, there is a whole race, and then the race continues to multiply descendants, sometimes suddenly some mutations occur, some of these mutations are born deformities, some have new abilities, people who are not adapted to the environment, (including deformities) are now being The environment is eliminated, and people who adapt to the environment (including those who mutate to develop new abilities) are retained, and more people with this new ability can be reproduced. This becomes the race of our next generation. Continue This cycle. In fact, computers can also apply this set of systems, so we have our genetic algorithm.

DNA in the computer

Insert picture description here
Everyone has his unique genetic information such as DNA. The reproduction of the population is the inheritance of this DNA, so the genetic algorithm has grasped this law. We tried to replace these biological forms with certain ways in the computer DNA. If we take a closer look at these DNAs, we will find that they are actually composed of a set of fixed structures. If you have not forgotten the biology of junior high school, this kind of small structure is called base pair. In the program In, we can also simulate these structures, inherit these structures to the next generation or mutate them. One of the most commonly used replacement methods is: we directly use 0 and 1 instead, because in the computer, everything is 01, 01 It is the language of the computer. Our hands and feet are translated from the most basic DNA information, so we can also use certain rules to translate 01 information into other information with a computer.
Insert picture description here
With these computers can understand In the form of DNA, we can simulate the reproduction of biological offspring. Suppose we have two DNA information from parents. We only need to select their respective pieces of information to form a new baby’s DNA information. In biological reproduction, there will still be From time to time, we can also reflect from this 01 system. Just change some places from 0 to 1, and 1 to 0. With these genetic mutations, plus the survival of the fittest , The theory that the uncomfortable is eliminated, your computer will have a group of small creatures that are gradually growing.

Guess you like

Origin blog.csdn.net/weixin_42990464/article/details/115339126