How to deal with implicit non-linear constraint in MATLAB GA function
4 次查看(过去 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:
- 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.
- 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:
- 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).
- 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
0 个评论
回答(1 个)
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.
You can see Objective and Nonlinear Constraints in the Same Function and Objective and Constraints Having a Common Function in Serial or Parallel, Problem-Based.
Good luck.
Sergio
0 个评论
另请参阅
类别
在 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!