91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5.85KB
    文件類型: .py
    金幣: 1
    下載: 0 次
    發布日期: 2021-03-01
  • 語言: Python
  • 標簽: nsga2??python??py??算法??

資源簡介

NSGA2算法實現 Python

資源截圖

代碼片段和文件信息

#?Program?Name:?NSGA-II.py
#?Description:?This?is?a?python?implementation?of?Prof.?Kalyanmoy?Deb‘s?popular?NSGA-II?algorithm
#?Author:?Haris?Ali?Khan?
#?Supervisor:?Prof.?Manoj?Kumar?Tiwari

#Importing?required?modules
import?math
import?random
import?matplotlib.pyplot?as?plt

#First?function?to?optimize
def?function1(x):
????value?=?-x**2
????return?value

#Second?function?to?optimize
def?function2(x):
????value?=?-(x-2)**2
????return?value

#Function?to?find?index?of?list
def?index_of(alist):
????for?i?in?range(0len(list)):
????????if?list[i]?==?a:
????????????return?i
????return?-1

#Function?to?sort?by?values
def?sort_by_values(list1?values):
????sorted_list?=?[]
????while(len(sorted_list)!=len(list1)):
????????if?index_of(min(values)values)?in?list1:
????????????sorted_list.append(index_of(min(values)values))
????????values[index_of(min(values)values)]?=?math.inf
????return?sorted_list

#Function?to?carry?out?NSGA-II‘s?fast?non?dominated?s

評論

共有 條評論