genetic algorithm mutation and searching design

6 次查看(过去 30 天)
Dear MATLAB Community,
I have a question about using the Genetic Algorithm (GA) to design an optimal cross section while keeping its area constant.
In my approach, I define the control points of the cross section in polar coordinates (radius and angle). These coordinates are the variables optimized by GA. After selecting the variables, I fit a NURBS curve through these control points and calculate the resulting area.
Here is a simple sketch of the method:
However, I’m facing a big problem: I want to avoid self-intersecting NURBS curves. These self-intersecting solutions are invalid and should be penalized. For example:
When I use a small number of control points (e.g., 5), increasing the GA population size often helps find reasonable designs. But when I increase the number of control points to 20 (i.e., 40 design variables), most GA-generated shapes become self-intersecting. As a result, the optimization converges to illogical solutions or produces inconsistent results, likely because the GA is being “trained” mostly on penalized (bad) solutions.
My questions are:
Is there any way to help GA explore only non-self-intersecting designs? As far as I know, bad solutions can be penalized, but is there a way to exclude them entirely from the search space?
Is it possible to provide GA with a good initial guess and then force it to mutate only slightly around this guess? For example, given a reasonable initial shape (see image below), can GA be constrained to move the control points only slightly until no further improvement is possible?
Any other suggestions are also very welcome. My main goal is to keep the cross-sectional area constant while optimizing other properties of the shape, without any self-intersections.
Best regards
  5 个评论
Mathieu NOE
Mathieu NOE 2025-7-4
I believe this is to show the result of a GA run gone in the wrong direction
I suspect that the IC should have theta sorted (do it if it's not the case !) , and with the penalty I suggested , it should remain so until the end of the optimisation
my 2 cents
Walter Roberson
Walter Roberson 2025-7-4
If the input variables are radius and angle for each point, and if the points are to be sorted by angle, then you could add a linear inequality constraint, theta1 <= theta2, theta2 <= theta3, theta3 <= theta4, theta4 <= theta5,
A = [1 -1 0 0 0; 0 1 -1 0 0; 0 0 1 -1 0; 0 0 0 1 -1], zeros(4,5)]; %theta then radius
b = [0; 0; 0; 0; 0];

请先登录,再进行评论。

采纳的回答

Mirhan
Mirhan 2025-8-9
Dear all,
Thank you for all your replies—they were very helpful for my understanding.
I have updated the algorithm to use Cartesian coordinates, which allows me to define additional constraints. With this change, the algorithm is now performing better than before.
Best regards,
Mirhan

更多回答(0 个)

类别

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

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by