gamultiobj constraints without any mathematical relation with variables

조회 수: 1 (최근 30일)
Sai Tejesh
Sai Tejesh 2022년 12월 6일
편집: Sai Tejesh 2022년 12월 10일
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.

답변 (1개)

Torsten
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
Torsten 2022년 12월 8일
As to my knowledge, you can do both in the OutputFunction: write out the iterates and stop the optimization.
Sai Tejesh
Sai Tejesh 2022년 12월 10일
편집: Sai Tejesh 2022년 12월 10일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by