cec2013(python):蜣螂优化算法DBO求解cec2013(提供python代码)

一、蜣螂优化算法DBO求解cec2013

cec2013函数简介

CEC 2013 Special Session on Real-Parameter Optimization中共有28个测试函数维度可选择为10/30/50/100。

每个测试函数的详细信息如下表所示:

参考文献:1 Liang J J , Qu B Y , Suganthan P N , et al. Problem Definitions and Evaluation Criteria for the CEC 2013 Special Session on Real-Parameter Optimization. 2013.

部分代码

复制代码
from CEC2013.cec2013 import *
from DBO import DBO
import matplotlib.pyplot as plt
import numpy as np
#主程序
function_name =8 #测试函数1-28
SearchAgents_no = 50#种群大小
Max_iter = 100#迭代次数
dim=10#维度 10/30/50/100
lb=-100*np.ones(dim)#下限
ub=100*np.ones(dim)#上限
cec_functions = cec2013(dim,function_name)
fobj=cec_functions.func#目标函数
BestX,BestF,curve = DBO(SearchAgents_no, Max_iter,lb,ub,dim,fobj)#问题求解




#画收敛曲线图
if BestF>0:
    plt.semilogy(curve,color='r',linewidth=2,label='DBO')
else:
    plt.plot(curve,color='r',linewidth=2,label='DBO')
plt.xlabel("Iteration")
plt.ylabel("Fitness")
plt.xlim(0,Max_iter)
plt.title("F"+str(function_name))
plt.legend()
plt.savefig(str(function_name)+'.png')
plt.show()
print('\nThe best solution is:\n'+str(BestX))
print('\nThe best optimal value of the objective funciton is:\n'+str(BestF))

部分结果

二、完整python代码

相关推荐
兵慌码乱7 小时前
基于Python+PyQt5+SQLite的药房管理系统实现:事务一致性与界面解耦全流程解析
python·sqlite·信号与槽·pyqt5·数据库设计·桌面应用开发·事务处理
ZhengEnCi8 小时前
09c-斯坦福CS336作业二:系统与分布式训练
人工智能
阿里云大数据AI技术8 小时前
用 SQL 解锁多模态数据分析:Hologres 让图片、语音、视频变成结构化洞察
人工智能
阿里云大数据AI技术9 小时前
EMR Serverless StarRocks 湖仓多模态检索:One SQL on One Data,实现全文 + 标量 + 向量三路混合检索
人工智能
金銀銅鐵9 小时前
[Python] 体验用欧几里得算法计算最大公约数的过程
python·数学
冬奇Lab10 小时前
Skill 系列(02):Skill 安全风险——三类攻击面的实战测试
人工智能·安全·开源
冬奇Lab10 小时前
每日一个开源项目(第138篇):OpenMontage - 把 AI 编程助手变成完整的视频制作团队
人工智能·开源·claude
米小虾10 小时前
智谱港股盘中市值突破万亿港元!GLM-5.2 开源引爆国产 AI 价值重估
人工智能·chatglm (智谱)
阿里云大数据AI技术10 小时前
义乌小商品城基于MaxFrame AI Function的亿级AI 数据产线提速之路
人工智能