看似很简单,但是弄了两天,之前用remove函数各种报错 import numpy c = numpy.zeros((34,34)) # c[a[0][0][0]][a[0][1][0]]+=1 for j in range(200): i = 0 while (2*i+1)<len(a[0]): c[a[j][2*i][0]][a[j][i*2+1][0]]+=1 i=i+1 shan=[] import numpy as np for i in range(len(c)): for j in range(len(c)): if c[i][j]==200: shan.append(i) shan.append(j) print(shan) l=0 def shaixuan(a,p): b = [] c = [] for m in range(len(a)): for n in range(len(a[0])): # for i in range(len(shan)): # print(m,n) if p==a[m][n][0]: b=a[m][:n]+a[m][n+1:] c.append(b) return c for i in range(len(shan)): print(shan[i]) a=shaixuan(a,shan[i]) print(len(a)) print(len(a[0]))
NSGA2改进尝试(二):根据信息素删除部分基因
最新推荐文章于 2024-06-04 21:14:22 发布