GA algorithm toolbox (define constraint)

조회 수: 4 (최근 30일)
hamed feizmohamadi
hamed feizmohamadi 2020년 9월 25일
댓글: hamed feizmohamadi 2020년 9월 26일
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
Walter Roberson 2020년 9월 25일
Your constraints require x4 = x5 but x5 is not constrained to be integer.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
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.
  댓글 수: 1
hamed feizmohamadi
hamed feizmohamadi 2020년 9월 26일
Thanks for the reply
Another question is to define the integer of the variables in the fitness function part?
Also this constraint
x1 == x6 * x4
x1 == x7 * x5
x2 == x8 * x4
x2 == x9 * x5
define In fitness function?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by