资源简介
matlab写的粒子群优化算法(Particle Swarm Optimization),测试过,很好用!
代码片段和文件信息
%
% Copyright (c) 2015 Yarpiz (www.yarpiz.com)
% All rights reserved. Please read the “license.txt“ for license terms.
%
% Project Code: YPEA102
% Project title: Implementation of Particle Swarm Optimization in MATLAB
% Publisher: Yarpiz (www.yarpiz.com)
%
% Developer: S. Mostapha Kalami Heris (Member of Yarpiz Team)
%
% Contact Info: sm.kalami@gmail.com info@yarpiz.com
%
clc;
clear;
close all;
%% Problem Definition
% CostFunction=@(x) Sphere(x); % Cost Function
CostFunction=@(x) Ackley(x); % Cost Function
nVar=30; % Number of Decision Variables
VarSize=[1 nVar]; % Size of Decision Variables Matrix
VarMin=-32; % Lower Bound of Variables
VarMax= 32; % Upper Bound of Variables
%% PSO Parameters
MaxIt=1000; % Maximum Number of Iterations
nPop=50; % Population Size (Swarm Size)
% PSO Parameters
w=1; % Inertia Weight
wdamp=0.99; % Inertia Weight Damping Ratio
c1=1.5; % Personal Learning Coefficient
c2=2.0; % Global Learning Coefficient
% If you would like to use Constriction Coefficients for PSO
% uncomment the following block and comment the above set of parameters.
% % Constriction Coefficients
% phi1=2.05;
% phi2=2.05;
% phi=phi1+phi2;
% chi=2/(phi-2+sqrt(phi^2-4*phi));
% w=chi; % Inertia Weight
% wdamp=1; % Inertia Weight Damping Ratio
% c1=chi*phi1; % Personal Learning Coefficient
% c2=chi*phi2; % Global Learning Coefficient
% Velocity Limits
VelMax=0.1*(VarMax-VarMin);
VelMin=-VelMax;
%% Initialization
empty_particle.Position=[];
empty_particle.Cost=[];
empty_particle.Velocity=[];
empty_particle.Best.Position=[];
empty_particle.Best.Cost=[];
particle=repmat(empty_particlenPop1);
GlobalBest.Cost=inf;
for i=1:nPop
% Initialize Position
particle(i).Position=unifrnd(VarMinVarMaxVarSize);
% Initialize Velocity
particle(i).Velocity=zeros(VarSize);
% Evaluation
particle(i).Cost=CostFunction(particle(i).Position);
% Update Personal Best
particle(i
相关资源
- pso_lssvm回归预测
- 粒子群算法源代码
- 基于pso的测试函数Griewank得MATLAB算法代
- 基于粒子群PSO算法系统辨识matlab程序
- 优化算法——粒子群算法(PSO)原理
- 粒子群算法求解BP神经网络参数
- PSO优化PID参数的matlab程序
- 粒子群算法PSOmatlab工具箱toolbox
- matlab——PSO算法以及两种适应度函数
- MATLAB智能算法超级学习手册
- 基于粒子群优化的极限学习机
- pso算法无功优化
- MOPSO多目标粒子群优化算法MATLAB实现可
- PSO优化RBFNN的MATLAB源代码
- 基于matlab的粒子群算法PSO工具箱
- pso-SVM的MATLAB程序
- my_CLPSO.m
- 带时间窗的车辆路径规划问题的粒子
- dpso算法matlab实现
- 带有约束条件的粒子群算法代码pso.
- pso优化BP的MATLAB代码
- matlab可用粒子群工具箱 - PSOt
- 复化Simpson公式
- 基于MATLAB的PSO算法.pdf
- 使用PSO算法进行PID控制器的整定matl
- MATLAB-PSO区域覆盖
- PSO-RBF的MATLAB程序实现
- PSO粒子群算法实现
- 粒子群pso算法
- 粒子群优化算法演示及matlab源程序
评论
共有 条评论