Ho to Constraint GA to Generate Population Within Design Space
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mirhan
el 10 de Abr. de 2025
Dear all,
I’m currently working on a genetic algorithm-based optimization and would like to constrain the GA to select design variables strictly within a predefined design space.
While I can set upper and lower bounds for the variables, my design space is more complex, and I’m working with a large population. I’m wondering if there’s a way to configure the GA so that it generates the populations entirely within the valid design space, rather than just filtering or penalizing out-of-bounds individuals afterward.
Attached is a simple sketch illustrating the shape of my design space.
Thanks in advance for your guidance!
Best regards,
Mirhan

0 comentarios
Respuesta aceptada
Matt J
el 10 de Abr. de 2025
Editada: Matt J
el 10 de Abr. de 2025
Yes, you can reparametrize the design vector x as,
x=t1*v1+t2*v2
where v1 and v2 are the direction vectors of the two rays bounding your cone,
v1=[cosd(150),sind(150)]
v2=[cosd(30), sind(30)]
The new design variables are t=[t1,t2], which only need simple positivity constraints to confine x to the cone.
2 comentarios
Matt J
el 10 de Abr. de 2025
Editada: Matt J
el 10 de Abr. de 2025
The code from your last comment is for a 3D problem, whereas your diagram was for a 2D problem. I will continue to assume the 2D problem whose design space is a cone at 30 degrees to the x-axis.
You need to reparametrize your fitness function in terms of t,
xoft=@(t) t(1)*v(1)+t(2)*v(2);
ObjectiveFunction = @(t) simple_objective( xoft(t));
% Run Genetic Algorithm
[t_opt, fval_opt] = ga(ObjectiveFunction, 2, [], [], [], [], [0,0], [], [], options);
x_opt = xoft(t_opt)
Más respuestas (0)
Ver también
Categorías
Más información sobre Genetic Algorithm en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!