ga with population from a given set

2 visualizzazioni (ultimi 30 giorni)
Dear all,
I am writing to ask you whether it is possibile to impose that, at each generation of genetic algorithm, the individuals (whose genotype is a string of 175 bits) belong to a given set. To be more clear, I would like that any individual x = [x(1) ... x(175)] to be equal to one of the rows of the binary matrix A \in \mathbb{R}^{2500 \ntimes 175}. Should I impose any nonlinear constrain? Or else? Many thanks for your kind attention and my best regards,
Fabio.

Risposta accettata

Elizabeth Reese
Elizabeth Reese il 9 Ago 2017
If you are not using a bitstring or custom for the PopulationType in your ga options, then you can encode this constraint using the nonlcon input. This would require you to write a function that returns C and Ceq such that C( x)<=0 and Ceq( x)=0. In your case, you can let C = [] and then assign Ceq to be a vector where Ceq(i) is 0 if individual i is fulfilling your constraint and 1 otherwise. You can use ismember to test if the x is a row of A.
If you are using those options for PopulationType, then ga and gamultiobj ignore all constraints. In this case, you may consider using gamultiobj and defining an objective function that penalizes the x's that are not a row of A. This would work in a similar way to how Ceq is formulated.
  1 Commento
jason beckell
jason beckell il 21 Ago 2017
Many thanks dear dr. VanDenburgh,
I didn't absolutely know that a logical function (dismember) could be used as a nonlinear constraint. Such news is a great relief for me.
Many thanks again and best regards,
Fabio.

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