How do I input linear constraints for the genetic algorithm function using discrete variables?

5 次查看(过去 30 天)
Hello,
I am using the matlab's ga algorithm to solve an optimization problem using discrete variables. My decision variable is set to take only integer values, then using a simple mapping function, my decision variable are transformed to the n'th indexed value in a list of specific values which i provide, where n is the integer value initially assigned to the decision variable. I followed the exact steps of the following link:
Within this link, they inputed non-linear constraints using a function. In my case, I am interested in inserting linear constraints of inequality, using the matrices A and b. The algorithm seems to not respect these constraints. This is possible because the algorithm is applying the constraints to the decision variables in the form of integers rather than their transformed form.
How should I inser the A and b matrices in such a scenario?
Thank you.
  19 个评论
Samer Alsamadi
Samer Alsamadi 2023-7-17
I wanted to try that method but read the writing linear constraints in the non-linear constraints part of the algorithm could lead to problems as the algo will mess things up. Do you have an idea if that is true or not? Thanks anyways for providing a code example!
Torsten
Torsten 2023-7-17
编辑:Torsten 2023-7-17
Your constraints are linear in the transformed variables, but not in the solution variables.
Or are you able to use A (which is multiplied by x, not x_trans) and b to set the constraints you want on x_trans ?
What you did in your code is setting x(1:10) >= t_ar(1:10), not x_trans(1:10) >= t_ar(1:10). And from what you wrote this is what you actually want, isn't it ?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Least Squares 的更多信息

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by