How do you fix error when run genetic algorithm in matlab?
Mostrar comentarios más antiguos
Hi everyone, I have used GA in matlab to solve my problem. I created a constraint function and fitness function for this problem.
When I ran the algorithm, It was error and didn't run.
Can you help me fix it?
I show you in below.
Undefined function 'fameanalysis' for input arguments of type 'double'.
Error in createAnonymousFcn>@(x)fcn(x,FcnArgs{:}) (line 11)
fcn_handle = @(x) fcn(x,FcnArgs{:});
Error in constrValidate (line 23)
[cineq,ceq] = nonlcon(Iterate.x');
Error in gacommon (line 136)
[LinearConstr, Iterate,nineqcstr,neqcstr,ncstr] = constrValidate(NonconFcn, ...
Error in ga (line 327)
[x,fval,exitFlag,output,population,scores,FitnessFcn,nvars,Aineq,bineq,Aeq,beq,lb,ub, ...
Error in threebayfifteenthstoryframeoptimization (line 58)
[xbest, fbest, exitflag] = ga(@framecost, 34, [], [], [], [], ...
Caused by:
Failure in initial user-supplied nonlinear constraint function evaluation.
Respuestas (2)
Walter Roberson
el 14 de Mayo de 2015
0 votos
We need to see the complete line of your call to ga()
It appears that in the 9th parameter, you passed in the string 'fameanalysis', and MATLAB is then trying to find a function named 'fameanalysis' to act as a constraint function.
Might I suggest that what you wanted was 'frameanalysis', that you were missing the 'r' ?
KHANH NGUYEN
el 15 de Mayo de 2015
Editada: Walter Roberson
el 15 de Mayo de 2015
3 comentarios
Walter Roberson
el 15 de Mayo de 2015
Why have you named one routine framecost with an "r", but the other one fameanalysis with no "r"? fameanalysis instead of frameanalysis ? You want to calculate the FAME of a FRAME ?
Walter Roberson
el 15 de Mayo de 2015
What is it you would like to know about those options?
KHANH NGUYEN
el 21 de Mayo de 2015
Categorías
Más información sobre Genetic Algorithm en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!