Optimization running. Error running optimization. Too many input arguments.

2 views (last 30 days)
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

Accepted Answer

Alan Weiss
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

More Answers (3)

b
b on 7 May 2012
I could not create "options" in this function. In my project, i want to optimize media components of a fermentor. i think in that options part, i should write boundaries of independent variables. ??
Thanks for your interest..

Alan Weiss
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

b
b on 10 May 2012
Sorry for that :) At that moment, i got exhausted. even i did not understand what i wrote.
Thanks for interest.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!