遗传工具箱主要有三个
optimtool('ga')
在matlab 2018b中可以调用GA工具箱
利用遗传算法求解非线性方程组
下面的解释与上面的数值可能有不对,基本一致,存在不一致的地方
模拟退火算法
svm工具箱
pso优化工具箱
github下载代码包
GitHub - sdnchen/psomatlab: Automatically exported from code.google.com/p/psomatlab
如果上面链接出错,尝试在下面的链接中找到上面的链接
Constrained Particle Swarm Optimization - File Exchange - MATLAB Central
if语句中表达1<=x<=10
- if size(options.PopInitRange,1) ~= 2 && size(options.PopInitRange,2) == 2
- % Transpose PopInitRange if user provides nvars x 2 matrix instead
- options.PopInitRange = options.PopInitRange' ;
- elseif size(options.PopInitRange,2) == 1 && nvars > 1
- % Resize PopInitRange in case it was given as one range for all dim
- options.PopInitRange = repmat(options.PopInitRange,1,nvars) ;
- elseif size(options.PopInitRange,2) ~= nvars
- msg = 'Number of dimensions of options.PopInitRange does not' ;
- msg = sprintf('%s match nvars. PopInitRange should be a',msg) ;
- error('%s 2 x 1 or 2 x nvars matrix.',msg) ;
- end