フィルターのクリア

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 Center および File ExchangeDiscrete Multiresolution Analysis についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by