資源簡介
和聲搜索算法的MATLAB代碼實現(xiàn),調(diào)試過,可以用的,希望給大家?guī)韼椭?
代碼片段和文件信息
%?Harmony?Search?Algorithm
%By?GuangDong?University?of?Technology
%By?機電工程學(xué)院
%By?機械設(shè)計制造及其自動化(卓越)
clc;clear?all;close?all
%%?Problem?Prametters
Dim=14;?%?problem?Dimention
Low=[0?0?0?0?0?0?0?0?0?0?0?0?0?0];?%?Low?Boundry?of?Problem
High=[5?5?5?5?5?5?5?5?5?5?5?5?5?5];?%?High?Boundry?of?Problem
Min=0;?%?Minimaization?or?maximaiz?of?Fun??if?Min=1?it?will?be?minimaze?the?function?and?if?Min=0?it?will?be?maximized?the?function.
%%?Harmony?Search?Parametters
HMS=100;%Harmony?Memory?Size?(Population?Number)
bw=0.2;
HMCR=0.95;%[1]?Harmony?Memory?Considering?Rate
PAR=0.3;%[1]?Pitch?Adjustment?Rate
MaxItr=10000;%?Maximum?number?of?Iteration
%%?Initialization
HM=zeros(HMSDim);
HF=zeros(HMS1);
for?i=1:HMS
????HM(i:)=Low+(High-Low).*rand(1Dim);
??????HF(i1)=HM(i1);
end
if?Min==1
????[WorstFitWorstLoc]=max(HF);
else
????[WorstFitWorstLoc]=min(HF);
end
%%?Iteration?Loop
for?Itr=1:MaxItr
????HarmonyIndex=fix(rand(1D
- 上一篇:Matlab程序_牛頓拉夫遜法&PQ;分解法計算潮流
- 下一篇:紅綠燈自動識別
評論
共有 條評論