finalver
This commit is contained in:
28
c_cpp/BA.py
28
c_cpp/BA.py
@ -34,18 +34,17 @@ for i in range(0, n):
|
||||
# inity[i] = 22-abs(i-17)*20/17
|
||||
|
||||
# finalx[i] = 5+3*int(i%7)
|
||||
# finaly[i] = 60
|
||||
# finalz[i] = 75+3*int(i/7)
|
||||
|
||||
initx[i] = 15+3*int(i%7)
|
||||
inity[i] = 80
|
||||
initz[i] = 75+3*int(i/7)
|
||||
|
||||
# finalz[i] = 75+3*int(i/7)
|
||||
# finaly[i] = finalz[i]-15
|
||||
initx[i] = 15+3*int(i%7)
|
||||
initz[i] = 75+3*int(i/7)
|
||||
inity[i] = initz[i]+5
|
||||
|
||||
psai = 2*math.pi*i/35
|
||||
finalx[i] = 120+10*math.cos(psai)
|
||||
finaly[i] = 80
|
||||
finalz[i] = 50+10*math.sin(psai)
|
||||
finaly[i] = 80+10*math.sin(psai)
|
||||
finalz[i] = 50
|
||||
|
||||
# initx[i] = 20 + 8 * math.cos(math.pi * 2 * i / n)
|
||||
# inity[i] = 80 + 8 * math.sin(math.pi * 2 * i / n)
|
||||
@ -124,7 +123,7 @@ con = getcon(initx,inity,initz)
|
||||
tasks = gettasks(dis)
|
||||
|
||||
for i in range(0, n):
|
||||
state[i, 0] = int(random.random() * n)
|
||||
state[i, 0] = int(i)
|
||||
|
||||
|
||||
#定义个体寻找相同点的函数
|
||||
@ -553,9 +552,9 @@ while (1):
|
||||
jishu = jishu + 1
|
||||
#或许需要在第30步时再一次分配
|
||||
|
||||
np.savetxt('D:/wsf1x.csv', hisplacex, fmt="%f", delimiter=",")
|
||||
np.savetxt('D:/wsf1y.csv', hisplacey, fmt="%f", delimiter=",")
|
||||
np.savetxt('D:/wsf1z.csv', hisplacez, fmt="%f", delimiter=",")
|
||||
np.savetxt('D:/wsf2x.csv', hisplacex, fmt="%f", delimiter=",")
|
||||
np.savetxt('D:/wsf2y.csv', hisplacey, fmt="%f", delimiter=",")
|
||||
np.savetxt('D:/wsf2z.csv', hisplacez, fmt="%f", delimiter=",")
|
||||
np.savetxt('D:/speed1x.csv', speedx, fmt="%f", delimiter=",")
|
||||
np.savetxt('D:/speed1y.csv', speedy, fmt="%f", delimiter=",")
|
||||
np.savetxt('D:/speed1z.csv', speedz, fmt="%f", delimiter=",")
|
||||
@ -621,5 +620,8 @@ ax.plot3D(100,100,0)
|
||||
ax.scatter3D(placex,placey,placez,c='blue',s = 0.1)
|
||||
ax.scatter3D(initx,inity,initz,c='red',s = 0.5)
|
||||
ax.scatter3D(finalx,finaly,finalz,c='red',s = 0.5)
|
||||
|
||||
# xcnt = []
|
||||
# for i in range(0,500):
|
||||
# xcnt.append(i)
|
||||
# plt.scatter(hisplacex)
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user