當我在MATLAB的全局優化工具箱中使用ga
函數時,我遇到了一個令人費解的錯誤,下面粘貼錯誤消息以查看是否有人可以解密這意味着什麼。全局優化工具箱中的遺傳算法(ga)與種子初始種羣的錯誤
我正在嘗試給ga
播種一個初始種羣,一個由nvar彈出的矩陣。但是,這會產生下面的錯誤。如果我傳入(pop-1)-by-nvar的初始種羣向量,我只能運行ga
。這有點不方便,因爲我想指定整個人口。我希望熟悉全局優化工具箱和ga
函數的人可以在這裏瞭解一些情況!
??? Index exceeds matrix dimensions.
Error in ==> gacreationlinearfeasible>lhsLambda at 213
[lambda(i,:),f,e] = fmincon(fun,lambda(i,:),[],[],Aeq,beq,lb,ub,[],opts);
Error in ==> gacreationlinearfeasible>feasibleLHS at 180
initialPopulation(boundary_points+1:interior_points+boundary_points,:) = ...
Error in ==> gacreationlinearfeasible at 42
feasiblePop = feasibleLHS(individualsToCreate,GenomeLength,options);
Error in ==> makeState at 30
state.Population = feval(options.CreationFcn,GenomeLength,FitnessFcn,options,options.CreationFcnArgs{:});
Error in ==> galincon at 18
state = makeState(GenomeLength,FitnessFcn,Iterate,output.problemtype,options);
Error in ==> ga at 282
[x,fval,exitFlag,output,population,scores] = galincon(FitnessFcn,nvars, ...
如果您發佈用於調用「ga」函數的代碼,它會有所幫助 – Amro 2012-07-31 14:20:56