How to deal with implicit non-linear constraint in MATLAB GA function

6 次查看(过去 30 天)
I already have non-linear constraints in my problem, which is handled by a non-linear constraint subroutine.
Now I want to add one more constraint and I think it is called "implicit" constraint, which can not be described as an explicit formula/function as the variables I am optimizing. To add this constraint, I need to read the outputs (which is calculated by a black box, an external .exe) and get the value "Output_h" and then the constraint is "Output_h<=LIMIT".
I think I have two options:
  1. Modify the objective function value. In my objective function subroutine (which reads the input.txt, call and run the black box, read the outputs, calculate the objective function), I will check the value "Output_h" to see whether it is satisfying the above constraint. If not, I will add a much larger value to the initial objective function value. I think this is called the penalty approach.
  2. Add one more non-linear constraint. In my non-linear constraint subroutine, I will call and run the black box, read the outputs, and get the value "Output_h" and then add the constraint "Output_h - LIMIT <= 0".
What do you think?
But I have some concerns:
  1. For the first option, based on my understanding, GA will learn from the previous generation (probably learn from the objective function value) and generate the next generation. But here, I modify the initial objective function value. I am wondering how GA will learn from this and try to get a better solution gradually. Actually/physically, even I don't know how to generate a better solution since the value "Output_h" is an "implicit" function of the input variables (I am optimizing more than 10 variables).
  2. For the second option, it seems that in my non-linear constraint subroutine, I will have a lot of codes the same as my objective function subroutine, including reading the input.txt, calling and running the black box, reading the outputs. For me, it seems that for each GA population/case, the black box will be called twice (in both non-linear constraint and objective function subroutines)? Do you think it is wasting of time? Do I have a better way to do this? In addition, every run of the black box will take around 60s, which is the reason why I am trying to find a more efficient way to add this constraint.
Thanks!
Min

回答(1 个)

Sergio Bragagnolo
Sergio Bragagnolo 2020-4-23
编辑:Sergio Bragagnolo 2020-4-23
Hello, I have a similar problem in my optimization problem.
I found the posibility of using a unique function for the objetive function and the non-linear constraint but I haven't implemented it yet.
Good luck.
Sergio

类别

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

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by