我刚接触面向对象编程和优化,由于缺乏关于Platypus的适当文档,我不得不问这个问题。我正在尝试在鸭嘴兽上使用NSGAII来解决翼型优化的最大化问题。我的初始种群是一个数组(比如100x13)。我需要用我的求值函数计算数组的每一行。
任何关于寻找有用的文档或解决方案的线索都将受到欢迎。提前谢谢。
发布于 2018-10-10 22:24:00
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])希望这能有所帮助
https://stackoverflow.com/questions/46835565
复制相似问题