GA Optimization Problem Airfoil

5 views (last 30 days)
Andrea Michelotti
Andrea Michelotti on 14 Apr 2021
Commented: Andrea Michelotti on 16 Apr 2021
Hello everyone,
I am using gamultiobj to obtain a Pareto front trying to opitmize an airfoil shape.
I have three variables (x, y, angle of attack) and two fitness functions: minimizing Drag coefficient and reaching a specific value for the Lift one.
The last one is set because I evaluate it after the study of the airfoil so I thought that it should not be set as a constraint.
Specifically, I set
Delta_CL_value=abs(CL_objective-CL_value)/CL_objective;
which has to be minimized.
I runned the script several times for each fitness function reaching same results through time but I can't find a good Pareto front when combining them.
I used standard option values beside first population (20x3) and max generation number (1000).
The boundaries are imposed to reach the solution as I already have one which I use as a benchmark.
Firstly, if the profile didn't give any feasable solution, I set NaN as fitness values and the scripts worked fine for infividual fitness functions but not when combining them: it founded one feasable solution over the whole population even over 1000 generations. The other ones where all NaNs.
After few attemps to understand what was happening, I changed NaN with 10 so CD_value would be much grater than feasable ones (approx 0.09) so as the relative error over CL. The results where better but the majority of the population was still far from Delta_CL_value=0 but more often with expected CD_value.
I thought that I had to change some parameters such as 'Population Size', 'MaxStallGenerations', 'Function Tolerance' and 'ParetoFraction' so I set different range values for each parameter and after that I runned all of the possible different configurations to see if I could find a good combination of those values but nothing seems to work, even with 5000 iteration.
I tried to define a NONLCON function in which I insert final_data (output of gamultiobj) as input and as output I defined [c ceq].
I switched to ga due to the fact that now I only have one fitness function.
[final_data,fval,...]=ga(@(variables) fitness_function(variables,3,[],[],[],[],lb,ub,@constraint,options);
with external fitness function
function [CD_value]=fitness_function(variables)
Algorithm
CL_value;
CD_value;
end
and constrained one
function [c ceq]=constraint_function(final_data)
global CL_objective
Algorithm
CL_value=operations
c=[];
ceq=abs(CL_objective-CL_value)/CL_objective;
end
Now, it worked for the constraint but not for the objective function CD_value which doesn't give any good result even it was left untouched. Maybe 1 run every 10 was fine. I used 20 individuals for the evaluations and only after 3000 iteration it starts to give some feasable but not so good results.
Due to the fact that I use the same algorithm for both fitness and constraint functions, I removed Algorithm from the constraint one, recalling CL_value from the fitness function:
function [CD_value]=fitness_function(variables)
global CL_value
Algorithm
CL_value;
CD_value;
end
function [c ceq]=constraint_function(final_data)
global CL_objective CL_value
c=[];
ceq=abs(CL_objective-CL_value)/CL_objective;
end
In this case the fitness function works fine but the constraint is not reached because for minimize the CD_value, the algorithm tries to reach CL_value=0 beside imposing it as a constraint.
I also modified input variables in constraint_function with variables instead of final_data (as I think I misunderstood the correct syntax):
function [c ceq]=constraint_function(variables)
global CL_objective CL_value
c=[];
ceq=abs(CL_objective-CL_value)/CL_objective;
end
Doing this, the algorithm worked 1 out of 5 runs only if I implement the whole Algorithm in the constraint function as before.
I tried different crossover functions and mutation ones but the results was almost the same.
Has anyone any suggestion?
Should I change the solver to another one?
Thank you in advance
  1 Comment
Andrea Michelotti
Andrea Michelotti on 16 Apr 2021
SOLVED:
the problem was that ga evaluates firstly the constraint function and after that the fitness one.
There were a gap of one individual between iterations.

Sign in to comment.

Answers (0)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!