Controlling accuracy of variables in ga

4 Ansichten (letzte 30 Tage)
Mehul Agrawal
Mehul Agrawal am 7 Jun. 2016
Bearbeitet: Alan Weiss am 8 Jun. 2016
I have a problem where I am trying to use GA with some constraints. If the objective function = f(X) and constraints are AX <= B, where X is single dimension vector; is there a way I can control the accuracy of x1, x2 etc. I want them to be correct to 2 decimal places only. I tried scaling the problem by 100 and then setting integer constraints, but then, GA ignores the creationFcn option (where I want it to create only feasible population). Is there an alternate method to this ?

Akzeptierte Antwort

Alan Weiss
Alan Weiss am 7 Jun. 2016
Bearbeitet: Alan Weiss am 7 Jun. 2016
You should definitely not use integer constraints when you don't need them.
The real question is, do you need to use ga? Think carefully about your problem. If it is smooth with smooth constraints (such as the one you mentioned), then use an Optimization Toolbox™ solver such as fmincon for speed and robustness. If your problem is not smooth, try patternsearch for speed and robustness.
It sounds like you don't need high accuracy for your solution. It is much easier to tune patternsearch than ga; for example, for two decimals of accuracy, set MeshTolerance to 3e-3 or something similar.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  2 Kommentare
Mehul Agrawal
Mehul Agrawal am 7 Jun. 2016
Thanks Alan. My problem is not continuous and has multiple local minima. I had tried pattern search initially, but it searches local minima only and converged to that. Also, it required initial point that I don't have.
Alan Weiss
Alan Weiss am 8 Jun. 2016
Bearbeitet: Alan Weiss am 8 Jun. 2016
If you have finite bounds on all variables, then I strongly suggest that you use patternsearch with a variety of initial points, perhaps
x0 = lb + rand(size(lb)).*(ub-lb);
You can create points and discard them if they are not feasible, meaning check whether
A*x0(:) <= b(:)
where A and b are your linear inequality constraints.
And if you don't have finite bounds on all variables, then you are not likely to get satisfaction from ga, because it has implicit bounds on its initial population anyway.
There is nothing magic in ga in terms of creating initial points. It uses linprog to generate feasible points that satisfy linear constraints and bounds (you could do that, too, for patternsearch). And patternsearch is so much faster, more robust, and easier to tune, that I believe you will be much more satisfied if you give it another try.
Alan Weiss
MATLAB mathematical toolbox documentation

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by