フィルターのクリア

How to run please this example perfectly to get optimal solution .. Thank you

1 回表示 (過去 30 日間)
f = [0 ; - 10 ; 0 ; - 6; - 20] ;
A = [1 0 0 0 0 ;
0 1 0 0 0 ;
0 0 1 0 0 ;
0 0 0 1 0 ;
0 0 0 0 1] ;
B = [4 ; 3 ; 3 ; 2 ; 2] ;
Aeq = [1 - 1 - 1 0 0 ; 0 0 1 - 1 - 1] ;
beq = [0; 0; 0; 0; 0];
lb = zeros (5, 1) ;
ub = zeros (5, 1) ;
x = linprog(f,A,B,Aeq,beq,lb,ub)
[x,fval] = linprog(f,A,Aeq,beq,lb,ub);

採用された回答

Steven Lord
Steven Lord 2023 年 5 月 4 日
lb = zeros (5, 1) ;
ub = zeros (5, 1) ;
So based on the way you've constructed the bounds, all the elements of your solution have to be greater than or equal to 0 and less than or equal to 0. The only possible solution that satisfies both sets of bounds is zeros(5, 1).
Are you sure that ub shouldn't be something like ones(5, 1)?
  7 件のコメント
Steven Lord
Steven Lord 2023 年 5 月 4 日
Yes, I saw that. I would have expected them also to appear in the "Therefore, the problem can be posed as the following linear program:" section as inequalities like the last three bound constraints. But due to a lack of space on the page I wonder if students solving the problem could overlook the last two equations (which I assumed appeared after the diagram on page 262.)
Dalia ElNakib
Dalia ElNakib 2023 年 5 月 6 日
Many Thanks for your clarifications.
Really appreciate your efforts.

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

その他の回答 (1 件)

Torsten
Torsten 2023 年 5 月 4 日
f = [0 ; -10 ; 0 ; -6; -20] ;
A = [1 0 0 0 0 ;
0 1 0 0 0 ;
0 0 1 0 0 ;
0 0 0 1 0 ;
0 0 0 0 1] ;
B = [4 ; 3 ; 3 ; 2 ; 2] ;
Aeq = [1 -1 -1 0 0 ; 0 0 1 -1 -1] ;
beq = [0; 0];
lb = zeros (5, 1) ;
ub = zeros (5, 1) ;
[x,fval] = linprog(f,A,B,Aeq,beq,lb,ub)
Optimal solution found.
x = 5×1
0 0 0 0 0
fval = 0
  2 件のコメント
Dalia ElNakib
Dalia ElNakib 2023 年 5 月 4 日
f = [0 ; -10 ; 0 ; -6; -20] ;
A = [1 0 0 0 0 ;
0 1 0 0 0 ;
0 0 1 0 0 ;
0 0 0 1 0 ;
0 0 0 0 1] ;
B = [4 ; 3 ; 3 ; 2 ; 2] ;
Aeq = [1 -1 -1 0 0 ; 0 0 1 -1 -1] ;
beq = [0; 0];
lb = zeros (5, 1) ;
ub = ones(5, 1);
[x,fval] = linprog(f,A,B,Aeq,beq,lb,ub);
Optimal solution found.
Dalia ElNakib
Dalia ElNakib 2023 年 5 月 4 日
編集済み: Dalia ElNakib 2023 年 5 月 4 日
Thank you so much
Both work to ge the optimal solution
Either:
lb = zeros (5, 1) ;
ub = zeros (5, 1) ;
Or
lb = zeros (5, 1) ;
ub = ones (5, 1) ;
f = [0 ; -10 ; 0 ; -6; -20] ;
A = [1 0 0 0 0 ;
0 1 0 0 0 ;
0 0 1 0 0 ;
0 0 0 1 0 ;
0 0 0 0 1] ;
B = [4 ; 3 ; 3 ; 2 ; 2] ;
Aeq = [1 -1 -1 0 0 ; 0 0 1 -1 -1] ;
beq = [0; 0];
lb = zeros (5, 1) ;
ub = zeros(5, 1);
[x,fval] = linprog(f,A,B,Aeq,beq,lb,ub);
Optimal solution found.

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

カテゴリ

Help Center および File ExchangeGet 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