遗传算法python库_介绍通用的遗传算法python库

遗传算法python库

Genetic algorithms (GA) are an optimization and search technique based on the principles of genetics and natural selection, in essence mimicking the natural evolution process that we observe in life. Their general principle is based on the concept of having an initial population composed of several individuals — with each representing a particular solution to the problem — and allow it to evolve to a state that maximizes its overall fitness, using three main operators: selection, crossover and mutation. We’ll look into these aspects a bit more in detail below.

遗传算法(GA)是一种基于遗传和自然选择原理的优化和搜索技术,实质上模仿了我们在生活中观察到的自然进化过程。 他们的一般原则基于以下概念: 初始人口由几个人组成,每个人代表一个特定的问题解决方案,并使用三个主要运算符将其发展为最大化整体适应性的状态: 选择交叉突变 。 我们将在下面更加详细地研究这些方面。

Genetic Algorithms are nothing short of fantastic, as they can be applied to many kinds of optimization problems and find solutions to complex functions for which we do not have a mathematical expression. This comes at a cost of computational complexity though, as, for large populations, we’ll have to evaluate the fitness of all individuals at every generation. If the fitness function is expensive, the algorithm run will be slow.

遗传算法简直就是太神奇了,因为它们可以应用于多种优化问题并找到我们没有数学表达式的复杂函数的解。 但是,这是以计算复杂性为代价的,因为对于大量人口,我们必须评估每一代所有个体的适应性。 如果适应度函数昂贵,则算法运行会很慢。

GA’s can be divided into Binary and Continuous, depending on the type of problem we’re optimizing for. Potentially all problems could be broken down as having their variables (genes) represented by binary strings, but in general, if the input space is real-valued, it makes more sense to use a continuous GA.

GA可以分为BinaryContinuous ,具体取决于我们要优化的问题类型。 可能所有问题都可以通过用二进制字符串表示其变量( 基因)来分解,但是总的来说,如果输入空间是实值,则使用连续 GA更有意义。

As there are fewer examples for continuous GA out there, the examples shown here will be for that version of GA.

由于那里连续GA的示例较少,因此此处显示的示例适用于该版本的GA。

Initialization

初始化

The search starts with a random population of N individuals. Each of those individuals corresponds to a chromosome, which encodes a sequence of genes representing a particular solution to the problem we’re trying to optimize for. Depending on the problem at hand, the genes representing the solution could be bits (0’s and 1’s) or continuous (real valued). An example of a real-valued chromosome representing a solution to a given problem with 9 variables (genes) is shown below.

搜索从N个个体的随机种群开始。 这些个体中的每一个都对应一条染色体 ,该染色体编码表示代表我们要优化的问题的特定解决方案的一系列基因。 根据当前的问题,代表解决方案的基因可以是位(0和1)或连续(实值)。 下面显示了一个实值染色体的示例,该染色体代表具有9个变量( 基因 )的给定问题的解决方案。

  • 3
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值