How to ask Matlab ga to continously regenerate individuals until they all satisfy user defined constraints prior to fitness evaluation

1 次查看(过去 30 天)
Dear all,
I am currently using matlab ga to set up an optimisation process, with a FE solver used for fitness value calculation. In my model, the design variables of each individual must satisfy a nonlinear constraint to ensure the FE model being successfully built and running okay in the evaluation phase for all generations.
I then wrote an nonlinear constraint function to do this but I found that not all individuals satisfy the constraint I've defined. For intances, if the population size is 100, there might be only 20 individuals that satisfy the constarint. I therefore wonder if there would be a way to ask matlab ga to continously generate individual until all individuals in the population satisfy the user defined constraints or pre-checking functions?
Any help is appreciated.

采纳的回答

Matt J
Matt J 2024-3-7
编辑:Matt J 2024-3-7
The way to handle that is to have the fitness function skip the FE modeling and return Inf (or some large penalizing value) if the constraints are not satisfied.
  1 个评论
fei yu
fei yu 2024-3-8
Thanks for your advice, Matt. It works alright for now.
It seems that matlab ga can somehow adjust the value of design variables to enable more more individuals in the subsequent generations to meet the constraint I defined. Besides, this also leads to an increase in the total runtime for the following generations as the optimisation proceeds, due to the growing number of "good" individuals.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by