Controlling accuracy of variables in ga

5 次查看(过去 30 天)
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 ?

采纳的回答

Alan Weiss
Alan Weiss 2016-6-7
编辑:Alan Weiss 2016-6-7
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 个评论
Mehul Agrawal
Mehul Agrawal 2016-6-7
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 2016-6-8
编辑:Alan Weiss 2016-6-8
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Direct Search 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by