how to use variables in fitness function in the genetic algorithm optimization?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ekin Ceyda Cetin
am 30 Dez. 2016
Kommentiert: Ekin Ceyda Cetin
am 4 Jan. 2017
i try to run genetic algorithm optimization using a fitness function that includes variables and i get this error.
--The following error occurred converting from sym to double:
DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use VPA.--
i used syms when i calculate the fitness function.
anyone has any ideas about this problem? thank you.
0 Kommentare
Akzeptierte Antwort
Alan Weiss
am 30 Dez. 2016
Global Optimization Toolbox function expect variables of type double, not symbolic. To use symbolic variables, first convert them to double type. For an efficient way to do this, see this example.
Alan Weiss
MATLAB mathematical toolbox documentation
4 Kommentare
Walter Roberson
am 4 Jan. 2017
Does the function involve multiple variables? If it does then when you call matlabFunction then provide the 'vars' option as a column vector of variable names instead of using the more common row vector of variable names.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Genetic Algorithm finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!