gamultiobj constraints without any mathematical relation with variables

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (1)

Torsten
Torsten il 6 Dic 2022
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 Commenti
Torsten
Torsten il 8 Dic 2022
As to my knowledge, you can do both in the OutputFunction: write out the iterates and stop the optimization.
Sai Tejesh
Sai Tejesh il 10 Dic 2022
Modificato: Sai Tejesh il 10 Dic 2022
Thank you so much Torsten, I will try to solve it with this output function then. It seems to have very less documentation regarding its usage for writing out the iterations.

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by