使用 DEAP 1.3 时出错:mutPolynomialBounded()

Error using DEAP 1.3: mutPolynomialBounded()

在运行我的优化中出现了mutPolynomialBounded的错误。

我的代码:

print('MinVals',MinVals)
print('MaxVals',MaxVals)        
toolbox.register("mate"  , tools.cxSimulatedBinaryBounded, low=MinVals, up=MaxVals,eta=20.)
toolbox.register("mutate", tools.mutPolynomialBounded, low=MinVals, up=MaxVals,eta=40.)
toolbox.register("select", tools.selNSGA2)
[...]
for Mutant in Offspring:
    if random.random() < MUTPB:
        print ('Mutant',Mutant)
        toolbox.mutate(Mutant)
        del Mutant.fitness.values

几代人后给予:

MinVals [7.9, 7.7, 20.0, 3.5, 3.0, 8.0, 0.0, 0.0]
MaxVals [8.1, 8.3, 60.0, 4.5, 4.0, 12.0, 0.5, 1.0]
    
Generation   1
('Mutant', [8.083703848590838, 8.239680639018465, 34.76921146679101, 3.93770884762232, 3.84484135043615, 8.268765311082381, 0.04670044781780919, 0.3362407430103522])
Traceback (most recent call last):

  File "<ipython-input-261-aee1f32cae8a>", line 1, in <module>
    runfile('/home/brunsj/05_Kurzprojekte/ML_Batchmeshing/Source/BatchMesh_DEAP_parallel.py', wdir='/home/brunsj/05_Kurzprojekte/ML_Batchmeshing/Source')

  File "/home/brunsj/.conda/envs/spyder/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 705, in runfile
    execfile(filename, namespace)

  File "/home/brunsj/.conda/envs/spyder/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 94, in execfile
    builtins.execfile(filename, *where)

  File "/home/brunsj/05_Kurzprojekte/ML_Batchmeshing/Source/BatchMesh_DEAP_parallel.py", line 487, in <module>
    DEAP_Meshing()

  File "/home/brunsj/05_Kurzprojekte/ML_Batchmeshing/Source/BatchMesh_DEAP_parallel.py", line 174, in DEAP_Meshing
    toolbox.mutate(Mutant)

TypeError: mutPolynomialBounded() takes exactly 5 arguments (4 given)

我不知道这里发生了什么...

如果我使用 toolbox.register("mutate", tools.mutGaussian, mu=0, sigma=1, indpb=0.2) 它会 运行 符合预期

简单错误:我在 toolbox.register("mutate", tools.mutPolynomialBounded, low=MinVals, up=MaxVals,eta=40.)

中遗漏了参数 indpb

使用 toolbox.register("mutate", tools.mutPolynomialBounded, low=MinVals, up=MaxVals,eta=40., indpb=1) 它运行。