Find an optimal solution for a system with matrix
3 ビュー (過去 30 日間)
古いコメントを表示
Hello exper,
I have a marix A=[0.8 0 ; 1 0.8] that i should maximize its elements : Max sum(A)
I have like Contraints sum(B)<= 4 , and B is a matrix B=[1 0 ;2 2]
an other constraint sum(C)<=3 , and C is a matrix C=[1 0 ;1 1]
I will be very grateful if you can help me
3 件のコメント
Matt J
2019 年 12 月 9 日
Note that x(1,2) has coefficient 0 in both the objective and constraints. It may as well not participate in the problem.
回答 (1 件)
Matt J
2019 年 12 月 8 日
f=-A(:);
Aineq=[B(:),C(:)].';
bineq=[4;3]
Xoptimal=linprog(f,Aineq,bineq)
2 件のコメント
Matt J
2019 年 12 月 9 日
編集済み: Matt J
2019 年 12 月 9 日
The problem is unbounded and has no finite solution. You need more constraints. If I assume all the X(i) are meant to be non-negative, then we get the following solution,
>> Xoptimal=linprog(f,Aineq,bineq,[],[],[0 0 0 0]);
>> reshape(Xoptimal,2,2)
ans =
2.0000 0
1.0000 0
Note that X(1,2) can really be chosen as any non-negative value since it does not contribute to the problem, as I mentioned above.
参考
カテゴリ
Help Center および File Exchange で Get Started with Optimization Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!