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

如何用已知的较好参数初始化种群 #215

Open
QinwenLuo opened this issue Jul 11, 2023 · 2 comments
Open

如何用已知的较好参数初始化种群 #215

QinwenLuo opened this issue Jul 11, 2023 · 2 comments

Comments

@QinwenLuo
Copy link

现在我有一组较好的参数,比如一组维度为(50,10)的numpy数组,其中元素都是float类型,其中50是种群大小,10是参数的维度,我可以用这个数组去初始化种群吗?如何实现呢?
我试过令self.Chrom=这个数组,但是在某个地方报错数据类型不支持,这个self.Chrom必须是int类型的numpy数组吗

@QinwenLuo
Copy link
Author

#81 已解决

@Butterflylyly
Copy link

请问,是这样写吗? 我的params_initial是一个list格式
ga = GA(func=obj_func, n_dim=dim, size_pop=4, max_iter=4, prob_mut=0.01, lb=lb, ub=ub, precision=pcs)
ga.Chrom = x2gray(x=np.array([params_initial]), n_dim=dim, lb=lb, ub=ub, precision=pcs)
但是我打印出的初始种群不一致?

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

No branches or pull requests

2 participants