Non-linear constraints with several input variables in fmincon

3 ビュー (過去 30 日間)
javm6
javm6 2021 年 9 月 16 日
編集済み: Matt J 2021 年 9 月 22 日
Hello everyone,
I am trying to solve the following optimization problem with fmincon:
To do this, I have made the following code:
fun = @(x) x'*L*x;
nonlcon = @(x) consfun(A,B,x);
x = fmincon(fun,x0,[],[],[],[],[],[],nonlcon);
Where ''consfun'' is the following function:
function [c,ceq] = consfun(A,B,x)
c = (norm(A*x,inf)/b)-D);
ceq = [];
end
However, the final solution, x, does not satisfy the non-linear constraint so I wonder if the code is correct in relation to the optimisation problem posed.
Can anyone help me?
Thank you very much for your time!
  1 件のコメント
Alan Weiss
Alan Weiss 2021 年 9 月 20 日
Did fmincon claim to give a feasible solution? If so, then in what way was the constraint violated? I mean, was consfun(A,B,x) > 0? If not, then you may need to search for a feasible solution. See Converged to an Infeasible Point.
Alan Weiss
MATLAB mathematical toolbox documentation

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

採用された回答

Matt J
Matt J 2021 年 9 月 20 日
編集済み: Matt J 2021 年 9 月 20 日
Your nonlinear constraints are not differentiable. That doesn't always spell disaster, but it breaks the assumptions of fmincon. Also, since your problem can be reformulated as a quadratic program, it would be better to use quadprog.
[m,n]=size(A);
e=ones(m,1);
Aineq=[A;-A];
bineq=[(B+b*D).*e ; -(B-b*D).*e];
x=quadprog(L,zeros(n,1),Aineq,bineq);
  4 件のコメント
Perry Mason
Perry Mason 2021 年 9 月 22 日
I meant that the constraint in the original problem of javm6 is defined in terms of the infinity norm.
I reckon your reformulation works if the constraint is defined using euclidean norm, but will this reformulation still work even if the infinity norm is used?
Cheers
Matt J
Matt J 2021 年 9 月 22 日
編集済み: Matt J 2021 年 9 月 22 日
The reformulation is equivalent to the original, posted problem with the inf-norm constraints. The inf-norm constraint in the can be re-written as the linear system,
-b*D <= A*x-B <= b*D
or
A*x <= B+b*D
-A*x <= -(B-b*D)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by