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

GA中严格限制解中的每个数的范围,应该怎么做 #194

Open
Ctiger96 opened this issue Jul 11, 2022 · 1 comment
Open

GA中严格限制解中的每个数的范围,应该怎么做 #194

Ctiger96 opened this issue Jul 11, 2022 · 1 comment

Comments

@Ctiger96
Copy link

问题:
解是一个三维向量 x=[x1, x2, x3](都是整数),它的下界为[1,1,1], 上界为[1,2,20]。也就是说 x1只能是1,x2可以是1或2,x3可以是1到20。想用GA的话,precision设置为1,上界是设置为ub=[2,3,21]吗?这样设置的话,这里计算出来的解会取到ub,在这一问题中是不允许的(计算适应度值时对解的范围有严格要求,超出范围则无法计算)。但是如果上界ub设置为[1,2,20],在计算lind_raw的时候就会报错,比如x1对应的lind_raw是0。
请问对于我这样的问题应该怎么编码,上界应该怎么取?或许我应该用整数编码?想听听大佬的意见,感激不尽。

@MiaoRanzz
Copy link

x1只能取1,那就不是变量了啊,不设置x1不就好了

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