How to automate small increments in function for Genetic Algorithm ?
Mostrar comentarios más antiguos
Hello everyone,
I have prepared code in matlab for genetic algorithm from toolbox for number of iteration (nit)
The function code is very long. In summary, the fitness function is
function [objfun]=numericalbeam(phi)
objfun=AA+BB+(y*CC)
end
y = 0.01 to 1 with small increments of 0.005...
GA code is prepared from toolbox.. The code ends as below
for i=1:nit
[x,fval,exitflag,output,population,score] =
GAcode(nvars,lb,ub,InitialPopulationRange_Data,PopulationSize_Data,EliteCount_Data,CrossoverFraction_Data,
MaxGenerations_Data,FunctionTolerance_Data,ConstraintTolerance_Data);
H1(i,1)=fval;
H2(i,:)=x;
end
H1 give function value and H2 gives unknowns for all iterations.
The code works perfectly fine when single value of y is taken for e.g. 0.01
Is it possible to apply a loop such that it automates small increment of 'y' and gives results of function and unknowns at end for different values of y ?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Genetic Algorithm en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!