How to set the variables of genetic algorithm toolbox changing 1 or 0?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Zhida DENG
am 23 Mai 2016
Kommentiert: Zhida DENG
am 23 Mai 2016
Hi,
It would be much appropriated that if anybody can tell me how to let the variables changing 1 or 0 by using genetic algorithm toolbox.
x = ga(fitnessfcn,nvars)
how to make the output 'x' change either 1 or 0.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Todd Leonhardt
am 23 Mai 2016
Bearbeitet: Todd Leonhardt
am 23 Mai 2016
If the output x is between 0 and 1 then you can simply do:
round(x);
If not, then you can define a threshold and do:
x = 0;
if x > threshold
x = 1;
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Genetic Algorithm finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!