资源简介
进化策略算法实现公交车调度,人工智能课程设计,自己原创,在MATLAB上调试通过
代码片段和文件信息
%进化策略算法 (μλ)-ES
%μ个父代进化产生λ个子代,新产生的λ个新个体中择优选择μ个个体作为下一代群体
%f(x)=x1+x2+x3+x4+x5+x6
clear all;
close all;
clc
%变量初始化
populationSize = 15; %种群大小及子代个数 比例1/7
childrenSize = 100;
best=0; %存放父代最优值及所在列
bestIndex=1;
fitness = zeros( childrenSize 13); %存放子代 其中(1:6)存放子代个体6个分量,(7:12)存放子代个体6个方差,(113)存放子代的适应度函数
population=zeros(populationSize 13); %存放父代
% 初始化父代
for i = 1 : populationSize
population(i 1) = round(rand * 60);
population(i 2) = round(rand * 70);
population(i 3) = round(rand * 60);
population(i 4) = round(rand * 50);
population(i 5) = round(rand * 20);
population(i 6) = round(rand * 30);
while (population(i 1)+population(i 6))<60||(population(i 1)+population(i 2))<70||...
(population(i 3)+population(i 2))<60||(population(i 4)+population(i 3))<50||...
(population(i 5)+population(i 4))<20 || (population(i 6)+population(i 5))<30
population(i 1) = round(rand * 60);
population(i 2) = round(rand * 70);
population(i 3) = round(rand * 60);
population(i 4) = round(rand * 50);
population(i 5) = round(rand * 20);
population(i 6) = round(rand * 30);
end
for j=7:13
population(ij)=3.0;%sigma初始化
if j==13
population(i 13) = population(i 1)+population(i 2)+population(i 3)+population(i 4)+population(i 5)+ population(i 6);
end
end
if best>population(i 13)
best=population(i13);
bestIndex=i;
end
end
bestFitness=population(bestIndex:);%精英保留
% 进行100次迭代
for t = 1 : 100
% 产生childrenSize个子代,并计算其方差、适应度保存到fitness数组中
for i=1:childrenSize
populationIndex = round(rand * (populationSize-1))+1;% 从父代中随机挑选一个用于产生子代
for j=1:6
fitness(i6+j)=population(populationIndex6+j) * exp(1 * normrnd(0 1) + 1 * normrnd(0 1)); % 调整sigma参数
fitness(ij)=round(population(populationIndex j) + fitness(i6+j) *normrnd(0 1));
end
fitness(i13)=fitness(i1)+fitness(i2)+fitness(i3)+fitness(i4)+fitness(i5)+fitness(i6);
%根据条件产生符合条件的子代
while fitness(i1) < 0 || fitness(i1) > 60 || fitness(i6) < 0 || fitness(i6) > 60 || (fitness(i1)+fitness(i6))<60 ||...
(fitness(i1)+fitness(i2))<70 || fitness(i2)<0 || fitness(i2)>70 || (fitness(i3)+fitness(i2))<60 || fitness(i3)<0 || fitness(i3)>60||...
(fitness(i3)+fitness(i4))<50 || fitness(i4)<0 || fitness(i4)>50 || (fitness(i5)+fitness(i4))<20 ||...
(fitness(i6)+fitness(i5))<30 || fitness(i5)<0 || fitness(i5)>30
for j=1:6
fitness(i6+j)=population(populationIndex6+j) * exp(1 * normrnd(0 1) + 1 * normrnd(0 1)); % 调整sigma参数
fitness(ij)=round(population(populationIndex j) + fitness(i6+j) *normrnd(0 1));
end
fitness(i13)=fitness(i1)+fitness(i2)+fitness(i3
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 91648 2014-03-21 19:37 EvolutionStrategy\BusDispatch.doc
文件 3624 2013-06-19 21:54 EvolutionStrategy\EvolutionStrategy.m
目录 0 2014-03-21 19:51 EvolutionStrategy
----------- --------- ---------- ----- ----
95272 3
相关资源
- 在MATLAB中采用RLS算法实现FIR自适应滤
- 压缩感知MP重构算法的matlab实现
- 哈夫曼matlab编解码
- Gasen_matlab实现.zip
- 心电图去噪MATLAB程序
- matlab运动估计代码.里面有源图像和运
- 用matlab读取视频文件中的图像,并对
- Matlab形态学梯度检测二值图像的边缘
- RSSI定位算法MATLAB代码
- matlab递归实现汉诺塔m函数文件(动画
- 物体在空间中的运动轨迹预测
- PCA人脸识别定位matlab代码
- HSMM程序matlab
- 增量式PID算法PDF+MATLAB源程序
- 变速积分PID控制算法PDF+MATLAB源程序
- 最小二乘拟合Gauss曲线Matlab
- matlab安装序列号以及license文件
- 可以matlab实现的四种图像去噪程序
- 基于Matlab的射频滤波器仿真设计
- 基于MATLAB的无刷直流电机模糊控制仿
- 自适应滤波器的MATLAB与FPGA实现
- 用MATLAB编写的贝叶斯算法程序.m
- 人脸特征提取matlab源码
- gabor滤波二值化.rar
- 基于MATLAB的语音信号特技处理延时、
- Floyd弗洛伊德算法matlab仿真代码。
- matlab实现中值滤波,不用medflict2函数
- Gabor特征提取MATLAB代码
- 椭圆拟合matlab程序
- 判断点是否在给定三角形内的matlab程
评论
共有 条评论