フィルターのクリア

How to define multiple nonlinear inequality constraints for 'fmincon'?

54 ビュー (過去 30 日間)
Li Yang
Li Yang 2016 年 4 月 15 日
コメント済み: Ertugrul Bayir 2023 年 4 月 5 日
Hello, I have a question about defining nonlinear inequality constraints for 'fmincon' function. With the example in document, it seems there can only be 1 equality and 1 inequality constraint
function [c,ceq] = circlecon(x)
c = (x(1)-1/3)^2 + (x(2)-1/3)^2 - (1/3)^2;
ceq = [];
end
What if I have no nonlinear equality constraint but have multiple nonlinear inequality constraints? Could anyone help me on this ? Thank you!

採用された回答

Torsten
Torsten 2016 年 4 月 15 日
function [c,ceq] = circlecon(x)
c(1) = (x(1)-1/3)^2 + (x(2)-1/3)^2 - (1/3)^2;
c(2) = ...;
c(3) = ...;
...
ceq = [];
end
Best wishes
Torsten.

その他の回答 (1 件)

amin ghorbanpour
amin ghorbanpour 2018 年 11 月 20 日
You can stack them all in one matrix:
c = []
function [c,ceq] = FUNCTION(x)
for i= 1:N % N is the number if iterations! your states for example
c1 = f(x(i));
c = [c c1];
end
ceq = [];
end
Good luck!

カテゴリ

Help Center および File ExchangeSolver-Based Nonlinear Optimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by