【发布时间】:2015-11-18 19:21:43
【问题描述】:
我想指定MATLAB优化工具箱的遗传算法生成的种群范围:
function y= fitness_fct(x,L,R,score_initial)
y=sqrt(power(((power(L,x(1)) +power(R,x(2))) -score_initial),2));
x(1) %here i see that the values are sometimes negative
end
for i=1:22
FitnessFunction =@(x) fitness_fct(x,L(i) ,R(i),score_initial(i));
[x,fval] = ga(FitnessFunction,2);
end
在文档中,范围自动设置为 [0;1] 但实际上并非如此。
【问题讨论】:
-
您希望初始人口在该范围内,还是必须
x始终保持在 [0;1] 内? -
x 始终属于生成的种群,我希望它保持在 [0;1] 内
标签: matlab optimization genetic-algorithm