Algorithms

算法模块旨在包含一些特定的算法,以便执行非常常见的进化算法。这里使用的方法更多是为了方便而非参考,因为每个进化算法的实现可能会无限变化。本模块中的大多数算法使用工具箱中注册的运算符。通常,用于交叉的关键字是mate(),用于突变的关键字是mutate(),选择的关键字是select(),求值的关键字是evaluate()。

鼓励编写自己的算法。

Complete Algorithms

这些是完全的装箱算法,在某种程度上局限于非常基本的进化计算概念。所有算法除了参数之外,还接受一个初始化的Statistics对象来维护进化的统计数据,一个初始化HallOfFame来保存种群中出现的最佳个体,以及一个布尔verbose来指定是否记录进化过程中发生的事情。

deap.algorithms。eaSimple(population,toolbox,cxpb,mutpb,ngen[,stats,halloffame,verbose])

Parameters:

  • population – A list of individuals.

  • toolbox – A Toolbox that contains the evolutionoperators.

  • cxpb – The probability of mating two individuals.

  • mutpb – The probability of mutating an individual.

  • ngen – The number of generation.

  • stats – A Statistics object that is updatedinplace, optional.在适当位置更新的Statistics对象,可选。

  • halloffame – A HallOfFame object that willcontain the best individuals, optional.

  • verbose – Whether or not to log the statistics.

Returns:

The final population

Returns:

A class:~deap.tools.Logbook with the statistics of theevolution

该算法接受一个群体,并使用varAnd()方法将其进化到位。它返回优化的种群和包含进化统计信息的日志。日志将包含生成编号、每一代的评估数量以及统计数据(如果提供统计数据作为参数)。cxpb和mutpb参数传递给varAnd()函数。伪代码如下所示

evaluate(population)
for g in range(ngen):population = select(population, len(population))offspring = varAnd(population, toolbox, cxpb, mutpb)evaluate(offspring)population = offspring

如上面的伪代码所述。首先,它评估具有无效适应度的个体。第二,它进入了迭代循环,在这个循环中,选择程序被用来完全取代父代。该算法的1:1替换比例要求选择过程是随机的,并且需要多次选择同一个个体,例如,selTournament()和selRoulette()。第三,它应用varAnd()函数生成下一代种群。第四,它评估新的个体,并计算该群体的统计数据。最后,当ngen生成完成后,算法返回一个包含最终种群和进化日志的元组。

此函数要求在工具箱中注册toolbox.mate()、toolbox.amute()、toolbox.select()和toolbox.avalate()别名。

deap.algorithms.eaMuPlusLambda

(population, toolbox, mu, lambda_, cxpb, mutpb, ngen[, stats, halloffame, verbose])

这是(μ+λ)进化算法。

Parameters:

  • population – A list of individuals.

  • toolbox – A Toolbox that contains the evolutionoperators.

  • mu – The number of individuals to select for the next generation.

  • lambda_ – The number of children to produce at each generation.

  • cxpb – The probability that an offspring is produced by crossover.

  • mutpb – The probability that an offspring is produced by mutation.

  • ngen – The number of generation.

  • stats – A Statistics object that is updatedinplace, optional.

  • halloffame – A HallOfFame object that willcontain the best individuals, optional.

  • verbose – Whether or not to log the statistics.

Returns:

The final population

Returns:

A class:~deap.tools.Logbook with the statistics of theevolution.

该算法接受一个群体,并使用varOr()函数将其进化到位。它返回优化的种群和包含进化统计信息的日志。日志将包含生成编号、每一代的评估数量以及统计数据(如果提供统计数据作为参数)。cxpb和mutpb参数传递给varOr()函数。伪代码如下所示

evaluate(population)
for g in range(ngen):offspring = varOr(population, toolbox, lambda_, cxpb, mutpb)evaluate(offspring)population = select(population + offspring, mu)

首先,对具有无效适应度的个体进行评估。第二,进化循环开始于从种群中产生lambda_后代,后代由varOr()函数生成。然后对后代进行评估,并从后代和种群中选择下一代种群。最后,当ngen生成完成后,算法返回一个包含最终种群和进化日志的元组。

此函数要求在工具箱中注册toolbox.mate()、toolbox.amute()、toolbox.select()和toolbox.avaluate()别名。此算法使用varOr()变量。

deap.algorithms.eaMuCommaLambda(population, toolbox, mu, lambda_, cxpb, mutpb, ngen[, stats, halloffame, verbose])

这是(μ,λ)进化算法。

Parameters:

  • population – A list of individuals.

  • toolbox – A Toolbox that contains the evolutionoperators.

  • mu – The number of individuals to select for the next generation.

  • lambda_ – The number of children to produce at each generation.

  • cxpb – The probability that an offspring is produced by crossover.

  • mutpb – The probability that an offspring is produced by mutation.

  • ngen – The number of generation.

  • stats – A Statistics object that is updatedinplace, optional.

  • halloffame – A HallOfFame object that willcontain the best individuals, optional.

  • verbose – Whether or not to log the statistics.

Returns:

The final population

Returns:

A class:~deap.tools.Logbook with the statistics of theevolution

该算法接受一个群体,并使用varOr()函数将其进化到位。它返回优化的种群和包含进化统计信息的日志。日志将包含生成编号、每一代的评估数量以及统计数据(如果提供统计数据作为参数)。cxpb和mutpb参数传递给varOr()函数。伪代码如下所示

evaluate(population)
for g in range(ngen):offspring = varOr(population, toolbox, lambda_, cxpb, mutpb)evaluate(offspring)population = select(offspring, mu)

deap.algorithms.eaGenerateUpdate(toolbox, ngen[, stats, halloffame, verbose])¶

This is algorithm implements the ask-tell model proposed in[Colette2010], where ask is called generate and tell is called update.

Parameters:

  • toolbox – A Toolbox that contains the evolutionoperators.

  • ngen – The number of generation.

  • stats – A Statistics object that is updatedinplace, optional.

  • halloffame – A HallOfFame object that willcontain the best individuals, optional.

  • verbose – Whether or not to log the statistics.

Returns:

The final population

Returns:

A class:~deap.tools.Logbook with the statistics of theevolution

该算法使用toolbox.generate()函数生成个体,并使用toolbox.update()函数更新生成方法。它返回优化的种群和包含进化统计信息的日志。日志将包含生成编号、每一代的评估数量以及统计数据(如果提供统计数据作为参数)。伪代码如下所示

for g in range(ngen):population = toolbox.generate()evaluate(population)toolbox.update(population)

Variations

变体是算法的较小部分,可以单独用于构建更复杂的算法。

deap.algorithms.varAnd(population, toolbox, cxpb, mutpb)

进化算法的一部分,仅应用变异部分(交叉和变异)。修改后的个体的适应度无效。个体被克隆,因此返回的种群独立于输入种群。

Parameters:

  • population – A list of individuals to vary.

  • toolbox – A Toolbox that contains the evolutionoperators.

  • cxpb – The probability of mating two individuals.

  • mutpb – The probability of mutating an individual.

Returns:

A list of varied individuals that are independent of theirparents.

变化如下。首先,使用toolbox.clone()方法复制亲代群体Pp,并将结果放入后代群体Po中。在Po上执行第一个循环以配对成对的连续个体。根据交叉概率cxpb,使用toolbox.mate()方法对个体xi和xi+1进行交配。由此产生的后代yi和yi+1取代了他们各自在Po的父母。在生成的Po上执行第二个循环,以概率mutpb对每个个体进行变异。当一个个体发生突变时,它会替换Po中未发生突变的版本。生成的Po返回。

这种变异被命名为And,因为它倾向于在个体身上同时应用交叉和突变。注意,这两种算子都没有系统地应用,生成的个体可以根据给定的概率从仅交叉、仅突变、交叉和突变以及繁殖中生成。两种概率都应在[0,1]内

deap.algorithms.varOr(population, toolbox, lambda_, cxpb, mutpb)

进化算法的一部分,只应用变异部分(交叉、变异或繁殖)。修改后的个体的适应度无效。个体被克隆,因此返回的种群独立于输入种群。

Parameters:

  • population – A list of individuals to vary.

  • toolbox – A Toolbox that contains the evolutionoperators.

  • lambda_ – The number of children to produce

  • cxpb – The probability of mating two individuals.

  • mutpb – The probability of mutating an individual.

Returns:

The final population.

变化如下。在每个lambda迭代中,它选择三个操作中的一个;交叉、突变或繁殖。在交叉的情况下,从父母群体Pp中随机选择两个个体,使用toolbox.clone()方法克隆这些个体,然后使用toolbox.mate()方法交配。只有第一个孩子被附加到后代群体Po,第二个孩子被丢弃。在突变的情况下,从Pp中随机选择一个个体,克隆该个体,然后使用toolbox.amutate()方法进行突变。产生的突变体被附加到Po上。在复制的情况下,从Pp中随机选择一个个体,克隆并附加到Po

.

这种变异被命名为“Or”,因为杂交和突变两种操作都不会产生后代。两种概率之和应为[0,1]

,繁殖概率为1-cxpb-mutpb。。

deap.algorithms模块库官方文档库翻译相关推荐

  1. cuSPARSE库官方文档部分翻译

    前言 级别1:稀疏格式的向量与密集格式的向量之间的操作 级别2:稀疏格式的矩阵与稠密向量之间的操作格式 级别3:稀疏格式的矩阵和一组密集格式的矢量(通常也可以看作密集的高矩阵)之间的运算 转换:允许在 ...

  2. python pymssql - pymssql模块官方文档的翻译

    译者注:译者博客(http://blog.csdn.net/lin_strong),转载请保留这条.此为pymssql模块version2.1.4官方文档的翻译,仅供学习交流使用,请勿用于商业用途. ...

  3. python的pymssql模块的报错_python pymssql - pymssql模块官方文档的翻译

    译者注:译者博客(http://blog.csdn.net/lin_strong),转载请保留这条.此为pymssql模块version2.1.4官方文档的翻译,仅供学习交流使用,请勿用于商业用途. ...

  4. CUDA10.0官方文档的翻译与学习之编程接口

    目录 背景 用nvcc编译 编译工作流 二进制适配性 ptx适配性 应用适配性 C/C++适配性 64位适配性 cuda c运行时 初始化 设备内存 共享内存 页锁主机内存 可移植内存 写合并内存 映 ...

  5. 【开源项目推荐】Android Jetpack 官方文档 中文翻译

    Jetpack 是 Android 软件组件的集合,使您可以更轻松地开发出色的 Android 应用.这些组件可帮助您遵循最佳做法.让您摆脱编写样板代码的工作并简化复杂任务,以便您将精力集中放在所需的 ...

  6. Pytorch官方文档英语翻译

    深度学习Pytorch-Pytorch官方文档英语翻译 1. a-e 1.1 span 跨度 1.2 blended 混合的 1.3 criterion 标准 1.4 deprecated 弃用的 1 ...

  7. Spring官方文档中文翻译

    准备做个Spring官方文档全翻译专栏以下是大目录, 本翻译是基于Spring5 Core Technologies

  8. ElasticSearch Java High level Rest Client 官方文档中文翻译(一)

    ElasticSearch Java High level Rest Client 官方文档中文翻译 一 纯粹记录自己在看官网的es rest high level api 时的翻译笔记,可以对照着官 ...

  9. iOS 9官方文档(翻译)

    iOS9已经发布一段时间了,我也在最近升级了Xcdoe 7.0正式版,升级后才发现又有了很多奇妙的变化,于是查看官方文档的一些解释,顺便做了一些翻译,和大家分享一下(转载请注明出处). iPad多任务 ...

最新文章

  1. Blender三维插图设计视频教程 3D Characters and Illustrations in Blender 2.9
  2. POJ 3616 Milking Time
  3. 2018年第九届蓝桥杯 - 省赛 - C/C++大学A组 - F.航班时间
  4. python定义对象的比较方法
  5. nuxt route 全局管理 route.beforeEach 替代
  6. 内蒙古一级计算机考试时间2015,2017年内蒙古计算机一级考试报名时间
  7. java 正则表达式的包_用于Java包名称的Python正则表达式
  8. python手机版做小游戏代码大全-用Python设计一个经典小游戏
  9. MAVEN常用知识点总结
  10. Unity3D for VR 学习(2): 暴风魔镜框架探索
  11. 【以太坊】代币创建过程
  12. 2022年北京购房攻略二 (城区交通篇)
  13. 十六条超炫代码让你的QQ空间改头换面(转)
  14. nginx ajax 504,内网配置错误引起的nginx 504 Connection timed out
  15. Dissect Eclipse Plugin Framework
  16. Python基础07
  17. C语言微信控制windows电脑代码,Windows电脑版微信实现多开 无需第三方软件(bat命令实现)...
  18. java制作海报一:java使用Graphics2D 在图片上写字,文字换行算法详解
  19. 产品经理之如何快速阐释产品价值(FABE模型)
  20. c语言减少控制流变量,C语言 第3章 控制流 (1简单程序设计).ppt

热门文章

  1. EasyCVR平台EHOME协议接入,视频播放出现断流是什么原因?
  2. C#毕业设计——基于C#+asp.net+sqlserver的选课系统设计与实现(毕业论文+程序源码)——选课系统
  3. python入门文件读取与写入_使用Python对Dicom文件进行读取与写入的实现
  4. 3、弱电工程从业者需要知道的基础网络知识
  5. 使用STM32 ST-LINK Utility下载程序教程
  6. 工艺计算机化系统验证,计算机化系统验证和工艺验证如何保持一致的方式
  7. mq服务器端口配置文件,Centos6.8 rabbitmq搭建且修改默认端口
  8. 分数S(Stockwell)变换Matlab代码
  9. ts多个type合并, 属性不唯一合并冲突问题
  10. Java JVM与内存管理