Closed whjdark closed 1 year ago
尝试着设置多条(2条以上)染色体,提示 RuntimeError: error in crtpp: FieldDR must be a matrix with 3 rows. (译码矩阵FieldDR必须是3行的Numpy ndarray类型矩阵。)
RuntimeError: error in crtpp: FieldDR must be a matrix with 3 rows. (译码矩阵FieldDR必须是3行的Numpy ndarray类型矩阵。)
Encodings = ['BG','BG','P'] Field0 = ea.crtfld(Encodings[0], problem.varTypes[:2], problem.ranges[:,:2], problem.borders[:,:2]) Field1 = ea.crtfld(Encodings[1], problem.varTypes[2:4], problem.ranges[:,2:4], problem.borders[:,2:4]) Field2 = ea.crtfld(Encodings[2], problem.varTypes[4:], problem.ranges[:,4:], problem.borders[:,4:]) Fields = [Field0 , Field1, Field2] population = ea.PsyPopulation(Encodings, Fields, NIND=150)
这个我也遇到过,你只需要打印一下你的数据,看一下格式就知道怎么回事了。把传进来的数据格式改成人家的数据格式就行了
尝试着设置多条(2条以上)染色体,提示
RuntimeError: error in crtpp: FieldDR must be a matrix with 3 rows. (译码矩阵FieldDR必须是3行的Numpy ndarray类型矩阵。)