How to use nested function in main program as constraint for a Genetic Algorithm that optimizes the main?

2 次查看(过去 30 天)
This is my main program:
function CDG=fuzz(a,b)
CDG=10*sum(b);
%code%
[a,b,c]=function flow(a,b)
[d,e,f]=function shrt(b)
end
The flow(a,b) and shrt(b) functions are in separate function-files. I'm using simple GA to minimize CDG. How to do this considering that a,b,c,d,e and f must be passed as constraint to the GA. The GA population vector is b.

回答(1 个)

Alan Weiss
Alan Weiss 2013-3-19
If you are looking for information about how to pass parameters, see this section. If you are looking for something else, feel free to ask again.
Alan Weiss
MATLAB mathematical toolbox documentation
  5 个评论
Alan Weiss
Alan Weiss 2013-3-25
Again, I am having trouble understanding you. You say your constraints are functions of x such as g(x). To me, g(x) is a function, not a constraint. A constraint would be something like g(x) < 0. Therefore, it sounds to me as if you have a nonlinear constraint g(x) < 0. This is a supported type of constraint; see this section of the documentation.
Again, I urge you to look at the link on avoiding double evaluation of the objective and constraints.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Bramer
Bramer 2013-3-25
Thanks, your suggestion did help me although the problem still remains. Deb's NSGA-II paper mentions a scheme for handling constraints (i.e. not just bound constraints on the decision variables, but "constraint functions"). This is what I'm talking about. Matlab's gamultiobj is supposed to be NSGA-II based, why doesn't it have a 'constraint functions' options? Further the simple GA can have integer variables but gamultiobj doesn't. This is queer.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by