Genetic algorithm say 'average change in the fitness value less than options.FunctionTolerance.'
4 views (last 30 days)
Show older comments
I am studying 'Genetic algorithm'. I made 'y2' for optimizing with this function ' y = 100 * (a^2 - b) ^2 + (1 - a)^2 '.
Those are same things. like between y = a + 3 and y = 2 + 3. and i want to get a = 2. I thought this way 'sum((y-y2).^2)'.
But it doesn't work well saying ''average change in the fitness value less than options.FunctionTolerance.' The results are not good. I think the iteration is not enough to optimize . and it ends.
How could I solve this problem....
Thank you so much..
.
.
.
y2 = 100 * (1.5083^2 - 2.2781) ^2 + (1 - 1.5083)^2;
rng default % For reproducibility
FitnessFunction = @(a,b) simple_fitness(y2);
numberOfVariables = 2;
lb = [-3 -3];
ub = [3 3];
[x,fval] = ga(FitnessFunction,numberOfVariables,[],[],[],[],lb,ub)
function of = simple_fitness(y2)
a=1;
b=1;
y = 100 * (a^2 - b) ^2 + (1 - a)^2;
of = sum((y-y2).^2);
end
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!