how to setup optimization routine with external objective function code

7 ビュー (過去 30 日間)
Hugo
Hugo 2021 年 6 月 28 日
コメント済み: Rik 2021 年 6 月 29 日
Hi,
I am currently facing problems when programming an optimization routine by coupling MATLAB with external software.
I tried to do a lot of tweaks to my code, but without success.
I found out that the design optimization vector is not being writen to my external text file input.txt for new runs.
My optimization routine is defined this way:
options = optimset('LargeScale','off','Display','iter','Diagnostics','on','MaxFunEvals',300,'MaxIter',4,'DiffMaxChange',1e+1,'DiffMinChange',1.0e-001,'TolFun',1.0e-04);
[x, fval, exitflag, output, lambda] = fmincon(@obj,x0,[],[],[],[],LB,UB,[],options)
How can I setup my code for the objective .m file obj.m to read the current value of x (variable vector under optimization)
I thank you in advance.
  1 件のコメント
Rik
Rik 2021 年 6 月 29 日
You obj function should accept the current x as input. Otherwise this code doesn't have much meaning.
Without the function signature it is difficult to suggest what you should do, as it looks like you already have what you need.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by