首页 > 解决方案 > 对于deap toolbox.evaluate postional 参数错误

问题描述

<ipython-input-48-92dbbdce203c> in play_game(mem_depth, population_size, generation_size, n_rounds, game)
     88     fitnesses = []
     89     for ind in population:
---> 90         fitness = toolbox.evaluate(ind)
     91         fitnesses.append(fitness)
     92 

TypeError: score() got multiple values for argument 'player1'

我不断从调用 score 函数的工具箱中收到此错误。scor函数的代码如下

# exercise 2(d)
def score(player1, player2, m_depth, n_rounds, game):
    #calculate the score for player1
    score = 0
    for i in range(n_rounds):
        move1 = player1
        move2 = next_move(player1, player2, i+1)
        score += payoff_to_player1(move1, move2, game)[0]
        player1 = process_move(player1, move1, m_depth)
        player2 = process_move(player2, move2, m_depth)
    return score

我做错了什么?

标签: pythonartificial-intelligencegenetic-algorithmgenetic-programmingdeap

解决方案


推荐阅读