MATLAB: GA algorithm toolbox (define constraint)

constraintga toolboxhelp

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?

Best Answer

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.
Related Question