Nonlinear inequality in GA optimization with integer constraints
1 次查看(过去 30 天)
显示 更早的评论
Hi, I am using GA optimization tool. The problem I am solving contains integer constraints (IntCon), but I need to set a non-linear inequality to the objective function. I am calculating the value of the function (k-eff) for patterns obtained from the genetic algorithm, but I need an inequality for the power, which must be kept below a certain value (power <= 1.3). What I consulted is that the inequalities [c, ceq] are set in the following way c(x) <= 0, so c(x) -1.3 <= 0. On the other hand for the problem with IntCon the ceq = [ ].
Thanks in advance.
2 个评论
Alan Weiss
2020-10-20
And what is the question? You stated some correct restrictions on c and ceq. But I don't understand what you want from us.
Alan Weiss
MATLAB mathematical toolbox documentation
回答(1 个)
Matt J
2020-10-20
编辑:Matt J
2020-10-20
In the code you have shown for POWER_CONSTRAINT(~), it does not make sense that POWER does not depend on the input, but rather on some independent .txt file. The point of the nonlinear constraint function is that it lets ga() query the feasibility of an input x. If the text file is supposed to have some dependence on x, then there should be code within POWER_CONSTRAINT(x) that regenerates POWER_PEAK.txt for the input x.
If the issue is that POWER_PEAK.txt is a heavy computation and you are trying to avoid repeating a computation that may have been already done elsewhere in your code, then read here:
2 个评论
Matt J
2020-10-20
编辑:Matt J
2020-10-20
with this value I run an external simualtion code for the objective function evaluation.
You are assuming though that the x that is passed to your constraint function will be the same as the x that ga() most recently passed to the objective function. Because that assumption is not always valid, however, your constraint function will sometimes need to re-run the simulation for the x that it receives as input. The link I gave you discusses how to implement that efficiently.
There is no way to check if you are using that function?
We don't have to check because it can be seen in your code that you are not using it. The input to POWER_CONSTRAINT is completely ignored.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!