遗传算法图解
In the previous post, We discussed what Artificial Intelligence (AI) in general. It would be less informative if we only know the information from the outside. So in this post, I will go into a little more detail into one of the methods that exist in the AI field.
在上一篇文章中,我们讨论了什么是人工智能 (AI)。 如果我们仅从外部知道信息,则信息量会减少。 所以在这篇文章中,我将更详细地介绍AI领域中存在的一种方法。
On this occasion, I will discuss an algorithm that is included in the AI field, namely Genetic Algorithms. The genetic algorithm is a part of Evolutionary Computation (EC) which is inspired by the process of evolution and natural selection of living things.
在这种情况下,我将讨论AI领域中包含的一种算法,即遗传算法 。 遗传算法是进化计算 (EC)的一部分,它受到进化过程和生物自然选择的启发。
Genetic algorithms are generally used to overcome optimization and search problems. This algorithm is a general algorithm so that it can be easily implemented in various problems and can provide better results for each iteration of the search solution. Genetic algorithms can find the best solutions from candidate sets that are broad and have many optimum points and also the results tend to go to the global optimum compared to similar methods such as hill-climbing, depth-first search, etc.
遗传算法通常用于克服优化和搜索问题。 该算法是一种通用算法,因此可以轻松地在各种问题中实现,并且可以为搜索解决方案的每次迭代提供更好的结果。 遗传算法可以从广泛且具有许多最佳点的候选集中找到最佳解决方案,并且与类似的方法(例如爬山 , 深度优先搜索等)相比,结果倾向于趋于全局最优。
Genetic algorithms can be used to solve a number of cases due to the following advantages.
由于以下优点,遗传算法可用于解决许多情况。
- Consists of many prospective solutions that are raised at once 由一次提出的许多预期解决方案组成
- Each iteration provides a candidate for a better solution 每次迭代都为更好的解决方案提供了候选者
- Large solution space is not a problem 解决方案空间大不是问题
- A fast and efficient algorithm 快速高效的算法
遗传算法中的术语 (Terms in Genetic Algorithms)
Before we go any further, we must know first about the terms that are commonly used in Genetic Algorithms.
在继续进行之前,我们必须首先了解遗传算法中常用的术语。
![Image for post](https://miro.medium.com/freeze/max/9999/1*dR4mHdPqvsEfoMluiYGcVg.gif)
- Population, collection of possible solutions. 人口,可能的解决方案的集合。
- Chromosome, one possible solution 染色体,一种可能的解决方案
- Genotype, elements contained in chromosomes 基因型,染色体中包含的元素
- Phenotype, value of genotype 表型,基因型值
In addition, there are also other terms that are often used in this algorithm.
另外,在此算法中还经常使用其他术语。
- Fitness function, function that determines the weight of each chromosome 适应度函数,决定每个染色体重量的函数
- Fitness Value, value obtained from the results of the fitness function 适应度值,从适应度函数的结果中获得的值
- Decoding and Encoding, in some cases, the phenotype can be changed to other forms. For example binary, real, permutation, and integer. Decoding and encoding