Optimization running. Error running optimization. Too many input arguments.
1 view (last 30 days)
Show older comments
I am working on genetic algorithm toolbox but i have a problem with creation function. i want to initialize real valued population by using creation function. my function is ;
function Chrom = crtrp(Nind,FieldDR) Chrom = rand(Nind,Nvar) .* FieldDR; end
in an another m. file, i identified FieldDR for boundaries. Is this a true approach? when i run the program the error occurs as
Error running optimization. Too many input arguments.
i could not understand why this occurs. Thanks.
PS: I am using MATLAB 2010a and Optimization Toolbox 5.0
0 Comments
Accepted Answer
Alan Weiss
on 7 May 2012
According to the documentation http://www.mathworks.com/help/toolbox/gads/f6174dfi10.html#f14223 the syntax for a creation function is
function Population = myfun(GenomeLength, FitnessFcn, options)
The input arguments to the function are
Genomelength — Number of independent variables for the fitness function
FitnessFcn — Fitness function
options — Options structure
The function returns Population, the initial population for the genetic algorithm.
Does your creation function satisfy this syntax? I really can't tell, but I am sure you can tell. Also, as you probably know, you must tell GA to use your creation function by setting the CreationFunction option to your creation function.
Alan Weiss
MATLAB mathematical toolbox documentation
0 Comments
More Answers (3)
Alan Weiss
on 8 May 2012
I am not sure I understand what you mean when you say "I could not create "options" in this function." GA passes the existing options to your creation function, your function can query and use the values if you like, or ignore them if you like.
I do not understand your next statements either. Sorry.
Alan Weiss
MATLAB mathematical toolbox documentation
0 Comments
See Also
Categories
Find more on Genetic Algorithm 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!