GA algorithm toolbox (define constraint)

1 visualizzazione (ultimi 30 giorni)
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 Commento
Walter Roberson
Walter Roberson il 25 Set 2020
Your constraints require x4 = x5 but x5 is not constrained to be integer.

Accedi per commentare.

Risposta accettata

Walter Roberson
Walter Roberson il 25 Set 2020
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 Commento
hamed feizmohamadi
hamed feizmohamadi il 26 Set 2020
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?

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by