How can I obtain an array of all different values with Genetic Algorithms?
3 views (last 30 days)
Show older comments
Hello everybody,
I am using genetic algorithms to obtain the best value of a fitness function. The fitness uses the data of an array. The dimension of the array is 50 and each element can have an integer value from 1 to 50. However, the values cannot be repeated, this means that we have an array of 50 elements and there should not be two elements with the same value. Does anybody know how can I specify tis constraint?
For now, I have this code, but in this case, the values are repeated:
for k = 1:50
lowbound(k) = 0;
upbound(k) = 50;
numstobeinteger(k) = k;
end
array_values= ga(@fitnFunc,50,[],[],[],[],lowbound,upbound,[], numstobeinteger);
Thanks in advance,
3 Comments
Answers (0)
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!