提交 c3194d63 编写于 作者: guofei9987's avatar guofei9987

modify comments

上级 c86e61e6
......@@ -15,6 +15,8 @@ class GA:
----------------
func : function
The func you want to do optimal
n_dim : int
number of variables of func
lb : array_like
The lower bound of every variables of func
ub : array_like
......
......@@ -38,12 +38,11 @@ class PSO:
Examples
-----------------------------
>>>demo_func = lambda x: x[0] ** 2 + (x[1] - 0.05) ** 2 + x[2] ** 2
>>>pso = PSO(func=demo_func, dim=3)
>>>pso.fit()
>>>print('best_x is ', pso.gbest_x)
>>>print('best_y is ', pso.gbest_y)
>>>pso.plot_history()
>>> demo_func = lambda x: x[0] ** 2 + (x[1] - 0.05) ** 2 + x[2] ** 2
>>> pso = PSO(func=demo_func, dim=3)
>>> gbest_x, gbest_y = pso.fit()
>>> print('best_x is ', pso.gbest_x, 'best_y is ', pso.gbest_y)
>>> pso.plot_history()
"""
def __init__(self, func, dim, pop=40, max_iter=150):
self.func = func
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册