目录
💥1 概述
📚2 运行结果
🎉3 参考文献
👨💻4 Matlab代码
💥1 概述
随着计算机科学与技术的迅速发展,人类生存空间的扩大以及认识与改造世界范围的拓宽,人们对科学技术提出了新的和更高的要求,其中高效的优化技术和智能计算的要求日益迫切。蛙跳算法是一种新兴的群智能优化算法,概念简单,易于实现。自从2003年Eusufr和Lansey首次应用该算法,之后在一些领域获得了成功应用。蛙跳算法具有较强的全局搜索能力,但同时对于一些复杂的问题依然存在着收敛速度不是很快、易于陷入局部极值的缺点,并且传统的蛙跳算法模型适合于解决连续优化问题,不适合解决离散的组合优化问题。为此,根据蛙跳算法的优化机理,提出了一种新的离散化蛙跳求解算法,并结合简化邻域搜索算法给出了三种改进策略,对新算法进行了改进。同时进行了仿真实验研究。
📚2 运行结果
主函数部分代码:
% Cite as: % Mostapha Kalami Heris, Shuffled Frog Leaping Algorithm in MATLAB (URL: https://yarpiz.com/71/ypea109-shuffled-frog-leaping-algorithm), Yarpiz, 2015. % % Contact Info: sm.kalami@gmail.com, info@yarpiz.com % clc; clear; close all; %% Problem Definition % Objective Function CostFunction = @(x) Sphere(x); nVar = 10; % Number of Unknown Variables VarSize = [1 nVar]; % Unknown Variables Matrix Size VarMin = -10; % Lower Bound of Unknown Variables VarMax = 10; % Upper Bound of Unknown Variables %% SFLA Parameters MaxIt = 1000; % Maximum Number of Iterations nPopMemeplex = 10; % Memeplex Size nPopMemeplex = max(nPopMemeplex, nVar+1); % Nelder-Mead Standard nMemeplex = 5; % Number of Memeplexes nPop = nMemeplex*nPopMemeplex; % Population Size I = reshape(1:nPop, nMemeplex, []); % FLA Parameters fla_params.q = max(round(0.3*nPopMemeplex), 2); % Number of Parents fla_params.alpha = 3; % Number of Offsprings fla_params.beta = 5; % Maximum Number of Iterations fla_params.sigma = 2; % Step Size fla_params.CostFunction = CostFunction; fla_params.VarMin = VarMin; fla_params.VarMax = VarMax; %% Initialization % Empty Individual Template empty_individual.Position = []; empty_individual.Cost = []; % Initialize Population Array pop = repmat(empty_individual, nPop, 1); % Initialize Population Members for i = 1:nPop pop(i).Position = unifrnd(VarMin, VarMax, VarSize); pop(i).Cost = CostFunction(pop(i).Position); end % Sort Population pop = SortPopulation(pop); % Update Best Solution Ever Found BestSol = pop(1); % Initialize Best Costs Record Array BestCosts = nan(MaxIt, 1); %% SFLA Main Loop for it = 1:MaxIt fla_params.BestSol = BestSol; % Initialize Memeplexes Array Memeplex = cell(nMemeplex, 1); % Form Memeplexes and Run FLA for j = 1:nMemeplex % Memeplex Formation Memeplex{j} = pop(I(j, :)); % Run FLA Memeplex{j} = RunFLA(Memeplex{j}, fla_params); % Insert Updated Memeplex into Population pop(I(j, :)) = Memeplex{j}; end % Sort Population pop = SortPopulation(pop); % Update Best Solution Ever Found BestSol = pop(1); % Store Best Cost Ever Found BestCosts(it) = BestSol.Cost; % Show Iteration Information disp(['Iteration ' num2str(it) ': Best Cost = ' num2str(BestCosts(it))]); end %% Results figure; %plot(BestCosts, 'LineWidth', 2); semilogy(BestCosts, 'LineWidth', 2); xlabel('Iteration'); ylabel('Best Cost'); grid on;
🎉3 参考文献
[1]赵守法. 蛙跳算法的研究与应用[D].华东师范大学,2008.
部分理论引用网络文献,若有侵权联系博主删除。