首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用矩阵作为Platypus MOEA的输入

使用矩阵作为Platypus MOEA的输入
EN

Stack Overflow用户
提问于 2017-10-20 01:24:50
回答 1查看 139关注 0票数 3

我刚接触面向对象编程和优化,由于缺乏关于Platypus的适当文档,我不得不问这个问题。我正在尝试在鸭嘴兽上使用NSGAII来解决翼型优化的最大化问题。我的初始种群是一个数组(比如100x13)。我需要用我的求值函数计算数组的每一行。

任何关于寻找有用的文档或解决方案的线索都将受到欢迎。提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2018-10-10 22:24:00

代码语言:javascript
复制
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])

希望这能有所帮助

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46835565

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档