1 Star 0 Fork 0

Repetition/OOD-AOA

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
rastrigin_main.py 1.54 KB
一键复制 编辑 原始数据 按行查看 历史
fauziarda 提交于 2021-08-13 07:41 . last version ood aoa
from numpy.core.fromnumeric import mean
from aoa import AOA
import rastrigin_problem
numOfObj = 20
maximumIteration = 10
C1 = 2
C2 = 6
C3 = 2 # coc engineering problem
C4 = 0.5 # coc engineering problem // sesuai dengan paper
# standar optimization problem for constants C3 and C4
# C3=1
# C4=2
function = rastrigin_problem.mainFunction
dim = rastrigin_problem.dimention
positionLimit = rastrigin_problem.limitInputs
limitFunction = rastrigin_problem.limitFunction
fitness = rastrigin_problem.fitness
lowerBound = positionLimit[0].lowerBound
upperBound = positionLimit[0].upperBound
solution, population = AOA(numOfObj,lowerBound,upperBound,maximumIteration,C3,C4, function, dim,positionLimit,limitFunction,fitness)
print(f"Restrigin Solution \nBestScore: {solution.score} \n x or position: {solution.position}\n")
# import math
# from numpy import random
# def rastrigin(x):
# temp = x**2
# nTemp = 10 - (10*math.cos(2*math.pi*x))
# return temp + nTemp
# X = Y = []
# for obyek in population :
# X += obyek.position
# for x in obyek.position:
# Y.append(rastrigin(x))
# print(f"len Y:{len(Y)}, lenX : {len(X)}")
# # normalisasi
# # for i in range(len(X)):
# # X[i] = (X[i] - mean(X))/(max(X) - min(X))
# # Y[i] = (Y[i] - mean(Y))/(max(Y) - min(Y))
# # for data in population:
# # print(data.position)
# # print("\n")
# import matplotlib.pyplot as plt
# # plt.scatter(X,Y)
# # plt.show()
# plt.scatter(X,Y)
# plt.plot(X,Y,"--")
# plt.show()
# plt.hist(Y)
# plt.show()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/repe/OOD-AOA.git
git@gitee.com:repe/OOD-AOA.git
repe
OOD-AOA
OOD-AOA
master

搜索帮助