We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
对于moea_demo3中的例子,我尝试用aimFunc改写,但是始终显示Objv不合法,经过检查我的objv1、objv2和Objv都是符合要求的,他们分别为:(30,),(30,),(30,2) ,下面是我改写的:
def aimFunc(self, pop): print(pop.sizes) vars = pop.Phen.astype(int) Objv1 = np.sum(self.P[vars,[0, 1, 2, 3, 4]],axis=1) Objv2 = np.sum(self.R[vars,[0, 1, 2, 3, 4]],axis=1) print(Objv1.shape) # 应该是 (NIND,) print(Objv2.shape) # 应该是 (NIND,) pop.CV = np.sum(self.C[vars,[0, 1, 2, 3, 4]],axis=1).T - 92 pop.Objv = np.vstack([Objv1,Objv2]).T print(pop.CV.shape) # 应该是 (NIND,) print(pop.Objv.shape) # 应该是 (NIND,2)
我的种群数设置的是30,调用的模板是NSGA-II
The text was updated successfully, but these errors were encountered:
这是demo用evalVars写的:
def evalVars(self, Vars): # 目标函数 x = Vars.astype(int) f1 = np.sum(self.P[x, [0, 1, 2, 3, 4]], 1) f2 = np.sum(self.R[x, [0, 1, 2, 3, 4]], 1) print(f1.shape) print(f2.shape) # 采用可行性法则处理约束 CV = np.array([np.sum(self.C[x, [0, 1, 2, 3, 4]], 1)]).T - 92 ObjV = np.vstack([f1, f2]).T print(CV.shape) print(ObjV.shape) return ObjV, CV
Sorry, something went wrong.
两者似乎没什么区别,可为什么用aimFunc就不合法呢
好吧,不用回复了,是ObjV中V被写成了小写
No branches or pull requests
对于moea_demo3中的例子,我尝试用aimFunc改写,但是始终显示Objv不合法,经过检查我的objv1、objv2和Objv都是符合要求的,他们分别为:(30,),(30,),(30,2) ,下面是我改写的:
我的种群数设置的是30,调用的模板是NSGA-II
The text was updated successfully, but these errors were encountered: