資源簡介
蟻獅算法(Ant Lion Algorithm)原創者論文
及相應的Python實現和matlab實現
及相應的Python實現和matlab實現

代碼片段和文件信息
#?coding:utf-8
“““
作者:zhaoxingfeng 日期:2016.12.02
功能:蟻獅優化算法,Ant?Lion?Optimizer(ALO)
版本:2.0
參考文獻:
[1]Seyedali?Mirjalili.The?Ant?Lion?Optimizer[J].ADVANCES?IN?ENGINEERING?SOFTWARE?2015?83?80-98.
[2]Verma?S.?Mukherjee?V.Optimal?real?power?rescheduling?of?generators?for?congestion?management
???using?a?novel?ant?lion?optimiser[J].ENGINEERING?ELECTRICAL?&?ELECTRONIC201672548-2561.
[3]崔東文?王宗斌.?基于ALO-ENN算法的洪災評估模型及應[J].人民珠江?2016?37(5):?44-50.
說明:
2015年被人提出來的一種仿生優化算法,Ant?Lion?Optimizer即蟻獅優化算法,具有全局優化、調節參數少、收斂精度高、魯棒性
好的優點,已被應用到SVM、Elman神經網絡、GM(11)以及螺旋槳頁面曲線參數尋優等場合。
“““
from?__future__?import?division
import?numpy?as?np
import?random
import?matplotlib?as?mpl
import?matplotlib.pyplot?as?plt
import?time
class?ALO(object):
????def?__init__(self?N?Max_iter?lb?ub?dim?Fobj):
????????“““
????????N:螞蟻和蟻獅規模,螞蟻和蟻獅數量相等
????????Max_iter:最大迭代次數
????????lb?ub?:搜索范圍?->?變量取值范圍
????????dim:解的維度
????????Fobj:價值函數
????????“““
????????self.N?=?N
????????self.Max_iter?=?Max_iter
????????self.lb?=?np.array(lb)
????????self.ub?=?np.array(ub)
????????self.dim?=?dim
????????self.Fobj?=?Fobj
????#?初始化?ant?和?antlion?位置
????def?Initialization(self):
????????x?=?[[0?for?col?in?range(self.dim)]?for?row?in?range(self.N)]
????????for?i?in?range(self.N):
????????????for?j?in?range(self.dim):
????????????????x[i][j]?=?random.random()?*?(self.ub[j]-self.lb[j])?+?self.lb[j]
????????return?x
????#?輪盤賭
????def?RouletteWheelSelection(self?weights):
????????accumulation?=?[0?for?col?in?range(self.N)]
????????for?i?in?range(self.N):
????????????accumulation[-1]?=?0
????????????accumulation[i]?+=?accumulation[i-1]?+?weights[i]
????????p?=?random.random()?*?accumulation[-1]
????????for?j?in?range(self.N):
????????????if?accumulation[j]?>?p:
????????????????index?=?j
????????????????break
????????return?index
????#?隨機游走
????def?Random_walk_around_antlion(self?antlion?current_iter):
????????if?current_iter?>=?self.Max_iter?*?0.95:
????????????I?=?1?+?10**6?*?(current_iter/self.Max_iter)
????????elif?current_iter?>=?self.Max_iter?*?0.9:
????????????I?=?1?+?10**5?*?(current_iter/self.Max_iter)
????????elif?current_iter?>=?self.Max_iter?*?3/4:
????????????I?=?1?+?10**4?*?(current_iter/self.Max_iter)
????????elif?current_iter?>=?self.Max_iter?*?0.5:
????????????I?=?1?+?10**3?*?(current_iter/self.Max_iter)
????????else:
????????????I?=?1?+?10**2?*?(current_iter/self.Max_iter)
????????#?公式?(2.10)、(2.11)
????????lb?ub?=?self.lb/I?self.ub/I
????????#?公式?(2.8)
????????if?random.random()?0.5:
????????????lb?=?lb?+?antlion
????????else:
????????????lb?=?-lb?+?antlion
????????#?公式?(2.9)
????????if?random.random()?>=?0.5:
????????????ub?=?ub?+?antlion
????????else:
????????????ub?=?-ub?+?antlion
????????#?create?n?random?walks?and?normalize?accroding?to?lb?and?ub
????????RWs?=?[[0?for?col?in?range(self.dim)]?for?row?in?range(self.Max_iter?+?1)]
????????for?dim?in?range(self.dim):
????????????#?公式?(2.2
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-12-21?17:09??蟻獅算法\
?????文件?????2977466??2019-12-20?22:17??蟻獅算法\ALO.pdf
?????文件????????8962??2019-12-20?21:29??蟻獅算法\ALO.py
?????目錄???????????0??2019-12-21?17:09??蟻獅算法\matlab\
?????文件????????5844??2015-02-20?12:06??蟻獅算法\matlab\ALO.m
?????文件??????150992??2015-03-04?06:56??蟻獅算法\matlab\ALO.png
?????文件????????3597??2015-02-20?13:21??蟻獅算法\matlab\func_plot.m
?????文件????????7708??2015-02-20?12:07??蟻獅算法\matlab\Get_Functions_details.m
?????文件????????1881??2015-02-20?13:17??蟻獅算法\matlab\initialization.m
?????文件????????3105??2015-02-20?12:52??蟻獅算法\matlab\main.m
?????文件????????2932??2015-02-20?17:11??蟻獅算法\matlab\Random_walk_around_antlion.m
?????文件????????2199??2015-02-20?13:21??蟻獅算法\matlab\RouletteWheelSelection.m
評論
共有 條評論