フィルターのクリア

Failure in initial objective function evaluation. in fgoalattain

1 回表示 (過去 30 日間)
Li Xu
Li Xu 2022 年 4 月 13 日
回答済み: Riccardo Scorretti 2022 年 4 月 13 日
Hi Guys
I got some problem to run this code:
funn = @(x,y,z)[(0.42305*x+0.043383*y+0.16814*z-0.78716).^2;(-0.631363873*x-0.258982921*y+0.501872413*z-0.338137333).^2;(-22.09773556*x+4.532201111*y-35.13106889*z+30.95699333).^2];
goal = [0,0,0];
weight = [1,1,1];
x0 = [1 1 1];
[x,fval,attainfactor,exitflag]= fgoalattain(funn,x0,goal,weight,[],[],[],[],[1 1 1],[1.1 1.1 1.1])
The error said that there is a failure in initial objective function evaluation.
Could anyone help me about this error? Much appreciated!
Best regards
Xu Li

採用された回答

Riccardo Scorretti
Riccardo Scorretti 2022 年 4 月 13 日
Hi Li,
the error is that funn requires three arguments, whereas fgoalattain needs a function with a single argument.
To fix the problem it is enough to rewrite x = x(1), y = x(2) and z = x(3):
% funn = @(x,y,z)[(0.42305*x+0.043383*y+0.16814*z-0.78716).^2;(-0.631363873*x-0.258982921*y+0.501872413*z-0.338137333).^2;(-22.09773556*x+4.532201111*y-35.13106889*z+30.95699333).^2];
funn = @(x)[(0.42305*x(1)+0.043383*x(2)+0.16814*x(3)-0.78716).^2;(-0.631363873*x(1)-0.258982921*x(2)+0.501872413*x(3)-0.338137333).^2;(-22.09773556*x(1)+4.532201111*x(2)-35.13106889*x(3)+30.95699333).^2];
goal = [0,0,0];
weight = [1,1,1];
x0 = [1 1 1];
[x,fval,attainfactor,exitflag]= fgoalattain(funn,x0,goal,weight,[],[],[],[],[1 1 1],[1.1 1.1 1.1])
Local minimum possible. Constraints satisfied. fgoalattain stopped because the size of the current search direction is less than twice the value of the step size tolerance and constraints are satisfied to within the value of the constraint tolerance.
x = 1×3
1.0000 1.1000 1.0000
fval = 3×1
0.0220 0.5663 453.1104
attainfactor = 453.1104
exitflag = 4

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultiobjective Optimization についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by