필터 지우기
필터 지우기

Custom TuningGoal for systune

조회 수: 7 (최근 30일)
max.s
max.s 2022년 3월 18일
답변: Milan Bansal 2024년 2월 2일
I'm trying to implement a custom TuningGoal for the systune function. I started by copying the code of TuningGoal.Gain to a new class GainTest and adding the line
fObj = 1/fObj;
to the end of evalSpec_. I expected that when running this code:
k = realp('k', 200);
k.Minimum = 100;
k.Maximum = 500;
G = tf(k, [1 0.1 1], InputName='u', OutputName='y');
goal = GainTest('u', 'y', 1);
opt = systuneOptions(RandomStart=9, MaxIter=1000);
[sol, fSoft, ~, info] = systune(G, goal, opt);
It should maximize k instead of minimizing k because of the modification made to the tuning goal. To my suprise, k still gets minimized.
My feeling is that the tuning goals may be hardcompiled somewhere under the hood?... Is it possible to create custom TuningGoals?
PS: I've seen the other question on Custom TuningGoals, but I feel the option to just define custom classes was not even explored there.
  댓글 수: 1
max.s
max.s 2022년 3월 18일
Okay so I think I got this wrong. evalSpec is not used by systune, instead, the objective is converted to a SPECDATA struct whose Type field determines the operation.

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

답변 (1개)

Milan Bansal
Milan Bansal 2024년 2월 2일
Hi max.s
I understand that you are trying to implement a custom "TuningGoal" for the "systune" function. You have modified the "TuningGoal.Gain" class to create a new class, GainTest with the intention of inverting the objective function to maximize the gain instead of minimizing it.
  • The modification "fObj = 1/fObj" should invert the objective function, but it's important to ensure that this change is being applied in the context where "fObj" is used to calculate the cost for the optimization.
  • Instead of inverting the object function "fObj", make the objective negative, i.e., "fObj = - fObj". This modification does not change the shape of the objective function but will only turn the curve upside down.
  • Ensure that the custom "GainTest" class is being used by the "systune" function. It is possible that due to some misconfiguration, the original "TuningGoal.Gain" class is still being used.
Please refer to the following documentation links to learn more about the "systune" function and the "TuningGoal.Gain" object.
Hope this helps!

카테고리

Help CenterFile Exchange에서 Discrete Multiresolution Analysis에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by