Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to optimize multi-parameters by using your library #13

Closed
makabaka123456 opened this issue Mar 2, 2018 · 2 comments
Closed

how to optimize multi-parameters by using your library #13

makabaka123456 opened this issue Mar 2, 2018 · 2 comments
Labels

Comments

@makabaka123456
Copy link

how to optimize multi-parameters by using your library?
just like parameters in pid:(kp,ki,kd)

@PytLab
Copy link
Owner

PytLab commented Mar 2, 2018

无论是多少参数,gaft的使用方式都是相同的,这边我写了两个例子分别是优化有一个参数和两个参数的目标函数,更多参数可以通过在定义Individual的时候的给ranges再添加一个元素就好了,例如:

indv_template = BinaryIndividual(ranges=[(-2, 2), (-10, 2), (-10, 10)], eps=0.001)
population = Population(indv_template=indv_template, size=50).init()

这样你就创建了含有三个变量的大小为50的种群

剩下的就可以通过定义你自己的适应度函数就好了,注意适应度函数需要返回一个float类型的返回值,方便gaft对适应度函数的值进行操作。

@PytLab PytLab added the question label Mar 2, 2018
@makabaka123456
Copy link
Author

非常感谢。元宵节快乐~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants