Gene Boundaries for Genetic Algorithm
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am a bit stuck, as I am trying to set dynamic boundaries to the integers in the chromosomes, as they are made. For example, if a chromosome has the specific value [1 2 3 4 5 6], I was to ensure that the sum of the values is equal to a spefic number. How could i do that ?
0 comentarios
Respuestas (1)
TADA
el 14 de Feb. de 2019
data = randi(4, 1, 400);
seq = 1:6;
% if you mean the sum of that sequence you are looking for
x = sum(seq, 2);
if any(strfind(data, seq)) && sum(seq, 2) == x
disp('great success')
end
% or if you mean the sum of the whole vector:
x = sum(data, 2);
if any(strfind(data, seq)) && sum(data, 2) == x
disp('great success')
end
0 comentarios
Ver también
Categorías
Más información sobre Genetic Algorithm en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!