how to write series of multiple non-linear constraints for optimization using fmincon in MATLAB?

3 ビュー (過去 30 日間)
Hi, I have serios of multiple non-linear constraints and i am stuck how to write them in MATLAB, please help me out how to write the overall sum for n values. I have attached the problem below.
constraints.png
e.g. if phi and tau are the optimal variables which are x(1) and x (2) and the value of beta = 5,
Rn is the sumrate of main code and Rn' is the sumrate threshold value (10*1000) ,
function [c,ceq]=constraints(x)
c(1)=?
c(2)=?
c(3)=?
c(4)=sumrate(x)-10*1000
ceq=[];
end
how to erite the other constraints?
thank you in advance
  3 件のコメント
Maheen Fazal
Maheen Fazal 2019 年 9 月 17 日
Hi sir, here is my objective function
obj.png
shall i use linsolve instead of fmincon?
Maheen Fazal
Maheen Fazal 2019 年 9 月 17 日
how it can be linear beacuse i have Prn equal to this.
power.png

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

採用された回答

xi
xi 2019 年 9 月 17 日
編集済み: xi 2019 年 9 月 17 日
You have 2n parameters, named X1,X2...Xn(for phi) and Xn+1...X2n (for tau).
You need to write the constraints in the vectorized format of Ax-b<0, where A is a matrix, b is a vector. The #rows of A as well as the length of b is determined by how many contraints you have, and the #columns is 2n (number of parameters).
In your case, the first three sets of constraints are linear constraints (total of 1+1+2n=2n+2). Your A matrix should have 2n+2 rows:
A(1,:)= [ones(1,n),zeros(1,n)];
A(2,:)= [zeros(1,n),ones(1,n)];
A=[A;-eye(2*n)];
b=[(1-beta);beta;zeros(2*n,1)]
  10 件のコメント
xi
xi 2019 年 10 月 3 日
I don't see anything wrong. Just use the compact version. The way I wrote separately for A(1,:) and A(2,:) is just to help explain. Note that, 2 rows mean 2-constraint equations, not 2-parameters. It should also work unless A was already defined and you are likely to get the dimension mismatch error,
Maheen Fazal
Maheen Fazal 2019 年 10 月 4 日
Yes you are right, i have two parameters and for both parameters there are two separate equations.
constraintss.png
so for that i wrote linear inequality constraints like this as mentioned below, but still not getting the proper graph.
A=[ones(1,n),zeros(1,n);zeros(1,n),ones(1,n)]
b=[(1-B);B;];

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

その他の回答 (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