【问题标题】:Using matrices as input for Platypus MOEA使用矩阵作为鸭嘴兽 MOEA 的输入
【发布时间】:2018-03-31 19:49:49
【问题描述】:

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

【问题讨论】:

    标签: python optimization genetic-algorithm platypus-optimizer


    【解决方案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])
    

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-12
      • 1970-01-01
      • 2012-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多