ga with population from a given set

2 次查看(过去 30 天)
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.

采纳的回答

Elizabeth Reese
Elizabeth Reese 2017-8-9
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 个评论
jason beckell
jason beckell 2017-8-21
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Model Identification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by