i am getting different results for different times of running the genetic algorithm

8 views (last 30 days)
hi i'm working on a project in which i have to minimize the net annual cost( objective function). the variable range is in 500-5000. i am getting different results when i run it several times and also the results are weird. can anyone help me i have attached my objective function file and can anyone give me suggestions in choosing the parameters like mutation rate etc. thank you in advance
  3 Comments
trilochan
trilochan on 18 Oct 2013
Edited: trilochan on 18 Oct 2013
https://docs.google.com/document/d/1xHRkwEXGynsP6ElWm7TumkwVyVk-p5uCZs6uFTrXFaU/edit?usp=sharing
this is my function. sorry for not uploading my file for the first time
kalim ullah
kalim ullah on 1 Mar 2021
I am facing the same problem, I am using Multi objective particle swarm optimization for 2 objective functions.

Sign in to comment.

Accepted Answer

Alan Weiss
Alan Weiss on 17 Oct 2013
I didn't see any attachments, so I cannot comment directly on your problem.
Are you sure you want to use the genetic algorithm to solve your problem? If your problem is smooth, Optimization Toolbox solvers such as fmincon are usually faster and more reliable. And if your problem is not smooth, then patternsearch is usually faster and easier to tune than ga.
But if you insist on using ga, I suggest you try the following:
  • Give a good initial range
  • Use a large population, 200 or even more if you have a lot of variables
  • Set a large StallGenLimit to try to keep the solver from stopping prematurely
Basically, ga is a random search algorithm, so if you want better answers, you have to let it search a bigger space and take more tries.
I suggest again you use a different algorithm, either fmincon or patternsearch. You can start either of those solvers at random points within your bounds by using
x0 = lb + rand(size(lb)).*(ub - lb);
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  5 Comments
kalim ullah
kalim ullah on 1 Mar 2021
Please suggest algorithm for 3 objectives optimization problem. Is it possible to use optimization toolbox for 3 objective functions?
Alan Weiss
Alan Weiss on 2 Mar 2021
You would probably get more visibility for your question by creating a new question rather than adding an irrelevant answer to an existing question.
In Global Optimization Toolbox there are gamultiobj and paretosearch. In plain Optimization Toolbox there is fgoalattain. See Multiobjective Optimization and Generate and Plot Pareto Front.
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!