3

我是面向对象编程和优化的新手,由于缺少适当的鸭嘴兽文档,我不得不问这个问题。我正在尝试在鸭嘴兽上使用 NSGAII 来解决翼型优化的最大化问题。我的初始人口是一个数组(比如 [100 x 13])。我需要用我的评估函数评估数组的每一行。
任何有关寻找有用文档或解决方案的线索都值得赞赏。提前致谢。

4

1 回答 1

-1
from platypus import Problem, Real, NSGAII

def objectiveFunction()
  ....

  return result

problem = Problem(2, 1) # 2 is number of inputs 1 is number of objectives
problem.types[:] = Real(0, 10) # min and max initial guses
problem.function = objectiveFunction
problem.directions[:] = Problem.Maximize

algorithm = NSGAII(problem, 250) # 250 is the pupulation size
algorithm.run(500) # 500 is the number of function evaluation
result = algorithm.result

#to print the result
for ind, solution in enumerate(algorithm1.result):
    print(ind+1, solution.objectives[0])

希望这可以帮助

于 2018-10-10T14:24:00.067 回答