遗传算法Malab实例讲解PPT课件.pptx_第1页
遗传算法Malab实例讲解PPT课件.pptx_第2页
遗传算法Malab实例讲解PPT课件.pptx_第3页
遗传算法Malab实例讲解PPT课件.pptx_第4页
遗传算法Malab实例讲解PPT课件.pptx_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

遗传算法 GA 实例讲解 求函数f x 10 sin 5x 7 cos 4x x 0 10 的最大值 2020 3 20 1 函数最大值 f x 10 sin 5x 7 cos 4x 的最大值 f1 x f x 10 sin 5x 7 cos 4x 的最小值 x fval fminbnd 10 sin 5 x 7 cos 4 x 0 10 x 1 5708fval 17 0000 x 7 8540fval 17 0000f x 10 sin 5x 7 cos 4x x 0 10 的最大值为 x1 1 5708x2 7 8540F x1 f x2 17 0000 2020 3 20 2 主函数 Matlab仿真主程序 将x的值用一个10位的二值形式表示为二值问题 编码 一个10位的二值数提供的分辨率是 10 0 2 10 1 0 01 2020 3 20 3 群体初始化 将x的值用一个10位的二值形式表示为二值问题 编码 一个10位的二值数提供的分辨率是每为 10 0 2 10 1 0 01 2020 3 20 4 计算目标函数值 function objvalue calobjvalue pop temp1 decodechrom pop 1 10 x temp1 10 1023 objvalue 10 sin 5 x 7 cos 4 x end 2020 3 20 5 计算个体适应值 functionfitvalue calfitvalue objvalue globalCmin Cmin 0 px py size objvalue fori 1 pxifobjvalue i Cmin 0temp Cmin objvalue i elsetemp 0 0 endfitvalue i temp endfitvalue fitvalue end 2020 3 20 7 选择 function newpop selection pop fitvalue totalfit sum fitvalue fitvalue fitvalue totalfit fitvalue cumsum fitvalue px py size pop ms sort rand px 1 fitin 1 newin 1 whilenewin pxif ms newin fitvalue fitin newpop newin pop fitin newin newin 1 elsefitin fitin 1 endendend 2020 3 20 8 交叉 function newpop crossover pop pc px py size pop newpop ones size pop fori 1 2 px 1if rand pc cpoint round rand py newpop i pop i 1 cpoint pop i 1 cpoint 1 py newpop i 1 pop i 1 1 cpoint pop i cpoint 1 py elsenewpop i pop i newpop i 1 pop i 1 endendend 2020 3 20 9 变异 function newpop mutation pop pm px py size pop fori 1 pxif rand pm mpoint round rand py ifmpoint 0mpoint 1 endnewpop i pop i ifany newpop i mpoint 0 newpop i mpoint 1 elsenewpop i mpoint 0 endelsenewpop i pop i endendend 2020 3 20 10 计算最大适应值 function bestindividual bestfit best pop fitvalue px py size pop bestindividual pop 1 b

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论