GA error due to boxdirections
1 回表示 (過去 30 日間)
古いコメントを表示
I know there was a similar post in the forum ( here ), but my problem is definitely not because of typos in the objective function, because it works perfectly under patternsearch and simulatedannealing. I constantly get the error shown below here and this problem is so annoying that I couldn't sleep well lately, so any advice is greatly appreciated. It seems weird to me because I couldn't find anywhere in GA algorithm to set MeshSize. Version is Matlab 2012b.
"
Error using / Matrix dimensions must agree.
Error in boxdirections (line 23) pollParam = 1/sqrt(MeshSize);
Error in mutationadaptfeasible (line 71) [Basis,TangentCone] = boxdirections(true,StepSize,x,linCon.lb,linCon.ub,tol);
Error in stepGA (line 36) mutateKids = feval(options.MutationFcn, parents((1 + 2 * nXoverKids):end), options,GenomeLength,FitnessFcn,state,thisScore,thisPopulation,options.MutationFcnArgs{:});
Error in galincon (line 63) [score,population,state] = stepGA(score,population,options,state,GenomeLength,FitnessFcn);
Error in ga (line 351) [x,fval,exitFlag,output,population,scores] = galincon(FitnessFcn,nvars, ...
Error in GAOptimDesign (line 8) [x,fval] = ga(ObjectiveFunction,nvars,[],[],[],[],LB,UB)
"
My command for invoking GA is:
"
run ii_parameter_TBE.m; % to generate initial values, lb and ub of parameters
load parameter.mat;
load bound.mat;
options = gaoptimset('TolFun',1e-3,'PopulationSize',length(parameter)*2,'Display','diagnose');
rng('default')
[x,fval,exitFlag,output] = ga(@ii_objective,length(parameter),[],[],[],[],lb,ub,[],[],options);
"
Best regards,
Joe
0 件のコメント
回答 (2 件)
yvette-hyq
2015 年 4 月 16 日
編集済み: yvette-hyq
2015 年 4 月 17 日
Hi Joe,
Just wonder if you have found the cause of the problem. I have the exact problem as yours. The initialisation of this variable as I can trace back to is in line 28 to 44;
StepSize = 1;
in mutationadaptfeasible.m. But I don't see what the problem is when it comes to boxdirections.m.
I appreciate if you can share some suggestions. Thank you very much.
Yvette
0 件のコメント
Rakesh Kumar
2020 年 10 月 14 日
Before running your code, please issue this command (so MATLAB wil stop where an error is thrown)
dbstop if error
MATLAB will stop in boxdirections (line 23). Please check the value of MeshSize and report back.
Thanks,
Rakesh
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Direct Search についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!