⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpso1.f90

📁 这是一个经过改进的PSO算法
💻 F90
字号:
      real x10,x20,pi,pi0,o12,random,pq
	  double precision x1,x2
	  f(x1,x2)=(1+((x1+x2+1)**2)*(19-14*x1+3*x1*x1-14*x2+6*x1*x2+3*x2*x2))*(30+((2*x1-3*x2)**2)*(18-32*x1+12*x1*x1+48*x2-36*x1*x2+27*x2*x2))
	  print*,'please input k,c1,c2,r1,r2,循环次数m'
	  read*,k,c1,c2,r1,r2,m
	  print*,'please input x1,x2'
	  read*,x1,x2
	  pi0=f(x1,x2)
	  n=0
	  t=1.0
10    x10=x1
      x20=x2
	  n=n+1
	  t=t*0.9
	  o12=c1*r1+c2*r2
	  pq=(c1*r1*pi0+c2*r2*pi0)/(c1*r1+c2*r2)
	  random=o12/k
	  if(n/5.lt.100)then
	     w=o12+1.1
		 else if(x1.lt.200)then
		 w=o12-sqrt(O12)+1.0
		 else
		 w=o12-2*sqrt(o12)+0.9
	  end if
	  x1=w*x10+o12*(pq-x20)
	  x2=x20+x1
	  pi=f(x1,x2)
	  if(pi.lt.pi0.or.n.lt.m)then
	  pi0=pi
	  goto 10
	  else
      print*,'x1=',x1
	  print*,'x2=',x2
	  print*,'f(x1,x2)=',pi
	  print*,'n=',n
	  end if
	  end


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -