Having an error of function handler while using GA
2 views (last 30 days)
Show older comments
Fateme Fotuhi
on 27 Feb 2014
Commented: Fateme Fotuhi
on 27 Feb 2014
Hello everybody,
I have started using GA toolbox in matlab. When I want to run my code, it gives me the following error:
Error using functionHandleOrCell (line 13) The constraint function must be a function handle.
I dont really know what this means. I have a custom fitness function:
fun = @(chrom) fitnessfunction(chrom,lcap, lcapmain, cl, clmain, nump, ind, alpha, o, OD, tw,nc_nodes,nc,allnode, pc, dem, nt,x);
and I used fun in : [X fval] = ga(fun,gensize,[],[],[],[],LB,UB,options);
Chrom is my population. I will appreciate if you can help me.
Thanks
0 Comments
Accepted Answer
Sean de Wolski
on 27 Feb 2014
Run the following:
dbstop if error
This will stop when the error is thrown so you can inspect what's going on and which variable is not what you expect it to be.
More Answers (0)
See Also
Categories
Find more on Financial Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!