gamultiobj constraints without any mathematical relation with variables
1 次查看(过去 30 天)
显示 更早的评论
Hi everyone, I am carrying out Multi-objective design optimisation using gamultiobj of Global Optimization Toolbox, is there any way to stop the optimiser from computing the result (or to not consider that pearticular iteration) for a partcular iteration after performing a part of the code and fulfilling certain conditions?
For example, My fitness function is like this,
............................
..............code involving calcuating the area using some external software
area = extractBetween(lines_2(12),7,13);
area_number = str2num(area);
...........
y(1) = 1/max_l_d;
y(2) = overpressure;
END OF FITNESS FUNCTION
Now, I just want the optimiser to stop a particular iteration when area_number > 150 m^2. Also, this area is not directly mathematically related to the variables(else I would have used nonlcon or linear constraints), its calculation is done from some external software and we will not be getting this value until a part of fitness function code is executed, for every iteration. SO, hence the question is that it needs to stop executing that particular iteration when this condition is fulfilled.
0 个评论
回答(1 个)
Torsten
2022-12-6
Use an output function "OutputFcn" specified in the options structure of the solver.
Within this function, you can calculate "area_number" and decide how to proceed further.
From the documentation:
OutputFcn
Functions that ga calls at each iteration. Specify as a function handle or a cell array of function handles. See Output Function Options.
For an options structure, use OutputFcns.
Function handle or cell array of function handles | {[]}
3 个评论
Torsten
2022-12-8
As to my knowledge, you can do both in the OutputFunction: write out the iterates and stop the optimization.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!