Gene Boundaries for Genetic Algorithm
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
TADA
am 14 Feb. 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 Kommentare
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!