ga optimization changing answer
Show older comments
Hi everyone
I have a question about GA optimization answer.
I want to optimize this function with 5 variable, as below:
Q=ga(@(b) -(-1e-6*((b(1))^2)+5.69e2*(b(1))+...
-1e-6*((b(2))^2)+8e2*(b(2))+...
-1e-6*((b(3))^2)+4e2*(b(3))+...
-1e-6*((b(4))^2)+4e2*(b(4))+...
-1e-6*((b(5))^2)+5e2*(b(5))),5)
at first i run the code and the answer was what you can see below:
Optimization terminated: maximum number of generations exceeded.
Q =
1.0e+03 *
1.6325 2.2597 1.5050 1.4811 1.4940
i run the code for second time and the answer changed to:
Optimization terminated: maximum number of generations exceeded.
Q =
1.0e+03 *
1.8045 2.3893 1.4345 1.5154 1.5075
and for the third time the answer was:
Optimization terminated: maximum number of generations exceeded.
Q =
1.0e+03 *
1.8864 2.3098 1.4213 1.5103 1.2786
as you can see, the answer for each run was changed. why is this happening? I know that ga uses several iterations to obtain the answer, but I thought that the final answer is unique and fixed. am I doing something wrong? could you please explain this result for me?
Accepted Answer
More Answers (0)
Categories
Find more on Solver Outputs and Iterative Display 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!