PyGAD遗传算法适应度函数传入自定义参数方法

params为需要传入的参数,在fitness_function内定义计算适应度的方法

def fitness_function_custom(params):
    def fitness_function(solution, solution_idx):
        fitness = params
        return fitness 

    return fitness_function

https://www.5axxw.com/questions/content/9sr02k

你可能感兴趣的:(python,PyGAD,遗传算法)