Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Linear Constraint Fmincon Function Form

2 ビュー (過去 30 日間)
Michael Patterson
Michael Patterson 2020 年 7 月 25 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi
I am using fmincon and require a few linear equality and inequlity constraints. I am happy putting two of them into the matrix forms of Ax=b and Aeqx = beq but the third constraint requires me to call a function using values of x? Does anyone know how to do this? I have currently created a nonlcon function for it but it is linear so I don't know the effect of doing this?
for i = 1:N
ceq(i) = V{i}(2) - semistatic_mini(t{i}(1:2),I{i}(1:2),OCVfun,x(4),x(1),x(2),x(3),x(4+i),x(4+N+i),x(4+(2*N)+i));
end

回答 (1 件)

Matt J
Matt J 2020 年 7 月 25 日
編集済み: Matt J 2020 年 7 月 25 日
I have currently created a nonlcon function for it but it is linear so I don't know the effect of doing this?
There's nothing wrong with doing that if it really is computationally prohibitive to obtain a matrix representation of the function. However, if your function is not computationally intensive, a simple tool to obtain its matrix form is this FEX submission,
  2 件のコメント
Michael Patterson
Michael Patterson 2020 年 7 月 25 日
Thank you very much!
Matt J
Matt J 2020 年 7 月 25 日
You're welcome, but please Accept-click the answer if your issue is resolved.

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by