Skip to content

Commit 333e06a

Browse files
authored
Update WPA.py
1 parent be0f13a commit 333e06a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

WPA.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,13 @@ def run(self):
264264
n_dim = 2
265265
lb = [-5.12 for i in range(n_dim)]
266266
ub = [5.12 for i in range(n_dim)]
267-
demo_func = f11
267+
demo_func = f22
268268
# def __init__(self, pop_size=50, n_dim=2, alpha=4, beta=6, w=500, lb=-1e5, ub=1e5, max_iter=300, func=None):
269269
wpa = wpa(pop_size=50, n_dim=n_dim, max_iter=1000, lb=lb, ub=ub, func=demo_func, alpha=4, beta=6, w=500)
270270
wpa.run()
271271
print('best_x is ', wpa.gbest_x, 'best_y is', wpa.gbest_y)
272-
# f11 is best_x is [ 0.09110638 -0.71978079] best_y is -1.0312114438653428
273-
# f12 is best_x is [-448.40744098 403.16544094] best_y is -894.7260832993893 效果不行
272+
# f22 is best_x is [ 0.09110638 -0.71978079] best_y is -1.0312114438653428
273+
# f23 is best_x is [-448.40744098 403.16544094] best_y is -894.7260832993893 效果不行
274274
print(f'{demo_func(wpa.gbest_x)}\t{wpa.gbest_x}')
275275
plt.plot(wpa.gbest_y_hist)
276276
plt.show()

0 commit comments

Comments
 (0)