GA algorithm toolbox (define constraint)
1 次查看(过去 30 天)
显示 更早的评论
Hi
I have objective function with 5 variable which I have implemented in the genetic algorithm to optimize it .
I have trouble defining its constraint in the genetic algorithm.
The constraint I want to define:
- X1 & x2 & x4 is integer
- If I assume a is integer
- Then x1=A*x4 & x1=A*x5
- X2=A*x4 & X2=A*X5
Can someone guide me to define this constraint to GA toolbox matlba?
1 个评论
采纳的回答
Walter Roberson
2020-9-25
This kind of system can be programmed by introducing up to 4 new integer variables, with the logical conditions
x1 == x6 * x4
x1 == x7 * x5
x2 == x8 * x4
x2 == x9 * x5
You would then follow that by reducing the original equations, replacing each x1 by x6 * x4 and each x2 by x8 * x4 everywhere the equations,
Then you would add the nonlinear equality constraints
x6 * x4 - x7 * x5
x8 * x4 - x9 * x5
The list of variables would be x3, x4, x5, x6, x7, x8, x9 with x4 through x9 all integer variables (so x3 is the only non-integer variable.)
I know your original list did not require x5 to be integer, but your integer constraints on the other variables require that x5 be integer, I figure.
更多回答(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!