Search code examples
matlabconstraintsgenetic-algorithm

How to pass the following constraints to ga in matlab?


I am using the genetic algorithm (ga) in Matlab, and I have problems in providing few constraints to it. Up to now I have used ga by imposing only bounds LB and UB. Namely,

0<a_1<50, 0<a_2<50, -2<a_3<0, -50<b<0.

However, now I need that few further conditions are satisfied:

-54-b<a_1<-b, -2<a_3<(a_1+b)/27, sqrt(12*a_1*a_3+12*a_3*b)<a_2<-1/3*(a_1+b+27*a_3)

To introduce these constraints I could introduce a penalty factor in the objective function but GA would fail to find a global optimum vector. Do you know if there is a correct way to implement such constraints?

I'm new to ga and any suggestion would be very useful!


Solution

  • You can as well create your very own constraint function and then feed this function to ga(). Check this out for further insights. In this page you'll find a brief tutorial by Mathworks regarding Constrained Minimization Problem with both upper and lower bounds and constrains.