필터 지우기
필터 지우기

Find an optimal solution for a system with matrix

조회 수: 3 (최근 30일)
Imane hammou ouali
Imane hammou ouali 2019년 12월 7일
편집: Matt J 2019년 12월 9일
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
Imane hammou ouali
Imane hammou ouali 2019년 12월 7일
i want to maximize the sum of matrix A ,
its just like max ( 0.8x(1,1)+0 x(1,2)+ 1x(2,1)+0.8x(2,2) )
1x(1,1)+0 x(1,2)+ 2x(2,1)+2x(2,2) <=4
x(1,1)+0 x(1,2)+ 1x(2,1)+1x(2,2)<=3
Matt J
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
Matt J 2019년 12월 8일
f=-A(:);
Aineq=[B(:),C(:)].';
bineq=[4;3]
Xoptimal=linprog(f,Aineq,bineq)
  댓글 수: 2
Imane hammou ouali
Imane hammou ouali 2019년 12월 8일
Thank your for answering.But this is the result generated in matlab :
Xoptimal =
[]
any help please
Matt J
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 CenterFile 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!

Translated by