optimization using genetic algorithm

1 visualización (últimos 30 días)
risky amalia
risky amalia el 20 de Jun. de 2021
Respondida: Walter Roberson el 20 de Jun. de 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

Respuestas (1)

Walter Roberson
Walter Roberson el 20 de Jun. de 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.

Categorías

Más información sobre Genetic Algorithm en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by