필터 지우기
필터 지우기

To know the Exact Code Please To Run this Example: (optimization linprog)

조회 수: 4 (최근 30일)
Dalia ElNakib
Dalia ElNakib 2023년 5월 3일
편집: Torsten 2023년 5월 4일
Dear Eng.
I'm trying to solve this attached problem as Assignment using linprog Code
Then it will be solved through:
h(1) = 0.6
h(2) =0.8
h(3) =1
g(1) =0.1
g(2) =0.2
g(3) =0.3
C Matrix
C = [1
1
1]
A Matrix (3*3)
A= [h(1) - g(1)h(2) -g(3)h(3)
-g(2)h(1) h(2) -g(2)h(3)
-g(3)h(1) -g(3)h(2) h(3)]
b Matrix
b = [0
0
0]
Assuming Values for h's and Gamma's as shown above
Do you think we'll need Upper limit and Lower Limit for this example?
I need the correct Matlab Linprog Code to run please?
Thanks alot for your cooperation
I
  댓글 수: 7
Dalia ElNakib
Dalia ElNakib 2023년 5월 4일
h(1) = 0.6;
h(2) = 0.8;
h(3) = 1;
g(1) = 0.1;
g(2) = 0.2;
g(3) = 0.3;
%c Matrix
c = [1; 1; 1];
%A Matrix (3*3)
A = [h(1) -g(1)*h(2) -g(3)*h(3);-g(2)*h(1) h(2) -g(2)*h(3);-g(3)*h(1) -g(3)*h(2) h(3)];
%b Matrix
b = [0; 0 ;0];
%Bound constraint
lb = [0.0000003; 0.0000003; 0.0000003];
ub = [1000 ;1000 ;1000];
%Solve
p = linprog(c,A,b,[],[],lb,ub);
Optimal solution found.
Torsten
Torsten 2023년 5월 4일
편집: Torsten 2023년 5월 4일
No, my code from above was correct (using -A and -b).
I only wanted to point out that for linprog, it's necessary to pass -A and -b because the inequality is reversed compared to your problem formulation.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by