遗传算法求解函数最大值.docVIP

  • 4
  • 0
  • 约3.45千字
  • 约 6页
  • 2022-09-01 发布于山东
  • 举报
PAGE/NUMPAGES 优选文档 S311067019 李麒星 用遗传算法经过复制交织过程循环求解函数 f(x)=x^2在[0,31]区间上的最大值点x。 代码以下: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespaceProject2 { class Class1 { public int ff(int a) { return a*a; } public int Max(int []args) { int s=0; int m=args[0]; for (inti=0;iargs.Length;i++) { if (margs[i]) { m=args[i]; s=i; } } return s; } public int Min(int []args) { int s=0; int m=args[0]; { for (inti=0;iargs.Length;i++) if (margs[i]) { m=args[i]; s=i; } } returns; } staticvoidMain(String[]args) . 优选文档 S311067019李麒星 { string []A=newstring[4]; A[0]= 01101; A

文档评论(0)

1亿VIP精品文档

相关文档