Nonlinear inequality in GA optimization with integer constraints
1 view (last 30 days)
Show older comments
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 Comments
Alan Weiss
on 20 Oct 2020
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
Answers (1)
Matt J
on 20 Oct 2020
Edited: Matt J
on 20 Oct 2020
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 Comments
Matt J
on 20 Oct 2020
Edited: Matt J
on 20 Oct 2020
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.
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!