ga algorithm with vectors
7 views (last 30 days)
Show older comments
function y=funcion(d)
y=(2*(pi*(d(1)^2)/4))+(d(2)*(pi*(d(3)^2)/4))
%d(1)=[ 6 8 10 12], d(3)=[ 6 8 10 12], round(d(2))
y=570;
end
fit=@(d)funcion(d)
nvars=3;
[d,fval]=ga(fit,nvars)
How to solve a function through ga algortihm, if you have 3 variables, and two of them must be choosen between the numbers of a vector, and the third variable must be entire number?
0 Comments
Accepted Answer
Stephan
on 12 Feb 2019
Hi,
check this example in the documentation:
It is about integer variables and in the second section there is shown how to choose values for variables from a vector of given discrete values.
Best regards
Stephan
More Answers (0)
See Also
Categories
Find more on Dictionaries 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!