matlab 中mOpts或者Xopts所传递的参数里每个参数都代表什么意思?

我了解到matlab中xoverops是传递给交叉函数的参数。mutops是传递给变异函数的参数,但是在主程序中若这样定义:
xFns = 'arithXover';
%xOpts = [4 40];
%xOpts = [5 100];
xOpts = [8 100];

% Mutation Operators
mFns = 'nonUnifMutation';
%mOpts = [2 40 3];
%mOpts = [3 100 3];
mOpts = [15 100 3];

那么这里面xOpts = [8 100];和mOpts = [15 100 3]中的矩阵中每个元素(比如8)到底代表什么参数呢?
其中,调用的函数如下:
function [parent] = nonUnifMutate(parent,bounds,Ops)
cg=Ops(1); % Current Generation
mg=Ops(3); % Maximum Number of Generations
b=Ops(4); % Shape parameter
df = bounds(:,2) - bounds(:,1); % Range of the variables
numVar = size(parent,2)-1; % Get the number of variables
gama=rand*2-1;
%parent
% Pick a variable to mutate randomly from 1 to number of vars
mPoint = round(rand * (numVar-1)) + 1;
for i=1:numVar
if i==mPoint
newValue(i)=parent(i)+gama*0.1*df;

% md = round(rand); % Choose a direction of mutation
% if md % Mutate towards upper bound
% newValue(i)=parent(mPoint)+delta(cg,mg,bounds(1,2)-parent(mPoint),b);
% else % Mutate towards lower bound
% newValue(i)=parent(mPoint)-delta(cg,mg,parent(mPoint)-bounds(1,1),b);
% end

if newValue(i)<bounds(:,1)
newValue(i)=(newValue(i)+bounds(:,2))/2.0
elseif newValue(i)>bounds(:,2)
newValue(i)=(newValue(i)+bounds(:,1))/2.0
else
newValue(i)=newValue(i)
end

else
newValue(i)=parent(i);
end
end
parent(1:numVar) = newValue

function [c1,c2] = arithXover(p1,p2,bounds,Ops)
a = rand;
numVar=size(p1,2)-1;
b=round(rand*(numVar-1)+1);
p1;
p2;

for i=1:numVar
if i<=b
c1(1:i)=p1(1:i);
c2(1:i)=p2(1:i);
else
% c1(1:numVar)=p1(1:numVar)*a+p2(1:numVar)*(1-a);
% c2(1:numVar)=p1(1:numVar)*(1-a)+p2(1:numVar)*a;
c1(1:numVar+1)=p1(1:numVar+1)*a+p2(1:numVar+1)*(1-a);
c2(1:numVar+1)=p1(1:numVar+1)*(1-a)+p2(1:numVar+1)*a;

end
end
请高手指教哇,比较急,谢谢啦!!

第1个回答  2014-07-21
四年了都没人会嘛~~~擦哦
相似回答