Both weights and assigned values must be a sequence of numbers when assigning
to values of <class 'deap.creator.FitnessMin'>. Currently assigning value(s)
132 of <class 'numpy.int32'> to a fitness with weights (-1.0,).
出现这个问题的原因的,代码中应该为数字序列的地方不为数字序列
我碰到的情景是:
def eval(ind):
target = list('tobeornottobe')
# ord返回对应ASCII字符串的ASCII数值
target = [ord(item) for item in target]
return np.sum(np.abs(np.array(ind) - np.array(target))),
忘添加,
bug-Both weights and assigned values must be a sequence of numbers when assigning to values of <clas
最新推荐文章于 2021-05-07 16:48:23 发布