optimization using genetic algorithm

1 visualizzazione (ultimi 30 giorni)
risky amalia
risky amalia il 20 Giu 2021
Risposto: Walter Roberson il 20 Giu 2021
i have 4 variables to optimize in GA which each have Upper Bound 100% and Lower Bound 0%. i need the result didn't exceed 100% when all the variable is summed. how to sum up my 4 variables into 100%??what code i have to write??
%Constrain
UB = [1 1 1 1];
LB = [0 0 0 0];
eBangkit = [];
Individu = [];
eIndividu = [];
david = [];
Dadatfit = [];
Datfit = [];
summary = [];
eDadatfit = [];
efitnessmax = [];
eIndividuMax = [];
Bangkit = round(rand(Npop,Nbit*Nvar));
popsize = size(Bangkit,1);
for i = 1:Nvar
batas(i) = UB(i)-LB(i);
end

Risposte (1)

Walter Roberson
Walter Roberson il 20 Giu 2021
If you were using one of the Mathworks optimization functions such as ga() then you would use
A = [1 1 1 1]
b = 1
However you aappear to be writing your own ga code, so write whatever you want.

Prodotti


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by