How to automate small increments in function for Genetic Algorithm ?
Show older comments
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 ?
Accepted Answer
More Answers (0)
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!