简体   繁体   English

使用矩阵作为鸭嘴兽MOEA的输入

[英]Using matrices as input for Platypus MOEA

I am new to Object-Oriented Programming and Optimisation and due to the lack of proper documentation for Platypus, I am forced to ask this question. 我是面向对象编程和优化的新手,由于缺少有关鸭嘴兽的适当文档,我不得不问这个问题。 I am trying to use NSGAII on Platypus for a maximisation problem for airfoil optimisation. 我试图在鸭嘴兽上使用NSGAII来解决机翼优化的最大化问题。 My initial population is an array (say [100 x 13]). 我最初的人口是一个数组(例如[100 x 13])。 I need to evaluate every row of the array with my evaluation function. 我需要使用评估函数来评估数组的每一行。
Any leads on finding useful documentation or a solution for this is appreciated. 希望找到有用的文档或解决方案的任何线索。 Thanks in advance. 提前致谢。

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])

hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM