文章目录

【`获取资源`请见文章第4节:资源获取】1. 算法简介2. 部分代码展示3. 仿真结果展示4. 资源获取

【获取资源请见文章第4节:资源获取】

1. 算法简介

同核分子优化算法(Homonuclear Molecules Optimization,HMO)是一种新的元启发式算法,用于优化复杂和非线性问题。根据玻尔原子模型和同核分子的结构,HMO的灵感来自于原子周围电子的排列。该算法基于在给定量子数的搜索空间中创建一组原子的初始种群以及与每个原子(搜索代理)相关联的电子。在每次迭代中,选择每个原子的最佳电子作为原子核的新位置,多个原子向具有最佳解的原子移动,形成同核分子。总体而言,HMO优于一些常见的经典算法,比如GA和PSO,可以与新的高效算法(如EO)竞争。HMO算法于2022年发表。

2. 部分代码展示

%% The main Loops of HMO

for it=1:MaxIt % The iterations loop

for i=1:N % The atoms loop (number of atoms)

% These two loops are related to the electrons

for j=1:N_Layers % The layers loop (number of layers, depend on the type of atom)

for k=1:Layer(j,1) % The electrons loops

Atom(i).Layer(j).Electrons(k).X = Atom(i).X+unifrnd(-Atom(i).R(j),Atom(i).R(j),Size); % See (Eq. 8)

% The electrons position lmits

Atom(i).Layer(j).Electrons(k).X = max(Atom(i).Layer(j).Electrons(k).X,Min);

Atom(i).Layer(j).Electrons(k).X = min(Atom(i).Layer(j).Electrons(k).X,Max);

% Calculating the fitness of electrons

Atom(i).Layer(j).Electrons(k).Cost = Function(Atom(i).Layer(j).Electrons(k).X);

% Updating the best electron of each atom

if Atom(i).Layer(j).Electrons(k).Cost

Best_Electron(i).X = Atom(i).Layer(j).Electrons(k).X;

Best_Electron(i).Cost = Atom(i).Layer(j).Electrons(k).Cost;

L_Best_Electron(i,1) = j;

end

end

end

% Updating the atoms positions

Atom(i).X = Best_Electron(i).X; % See (Eq. 8)

Atom(i).Cost = Best_Electron(i).Cost;

% Updating the paramount Atom

if Atom(i).Cost

A = Atom(N_Best).X;

B = Atom(N_Best).Cost;

Atom(N_Best).X = Atom(i).X;

Atom(N_Best).Cost = Atom(i).Cost;

Atom(i).X = A;

Atom(i).Cost = B;

end

% Reduction of Bohr radius

if L_Best_Electron(i,1)==1

Atom(i).R = Atom(i).R.*exp(-10*Dr(i,1)/MaxIt); % See (Eq. 12)

Dr(i,1) = Dr(i,1)+1;

else

Atom(i).R = Atom(i).R;

end

end

3. 仿真结果展示

4. 资源获取

获取完整代码资源,名片

好文推荐

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。