No feasible solution found. How to fix it

6 ビュー (過去 30 日間)
Valeria Grosheva
Valeria Grosheva 2021 年 5 月 2 日
編集済み: Matt J 2021 年 5 月 3 日
I am solving a transport problem using lingprog, but I don't understand why it doesn't have a feasible solution. Could there be a bug in the code?
A = [ 4 5 6 7 7; 5 4 4 4 8; 4 6 5 7 6; 3 3 5 5 11];
b = [100 120 80 100 100 80 120 130 110];
C = cat(2, A(1,:), A(2, :), A (3,:), A (4,:));
lb=zeros(1,length(C));
p1 = cat(2, ones(1,5), zeros(1,5), zeros (1,5), zeros (1,5));
p2 = cat(2, zeros(1,5), ones(1,5), zeros (1,5), zeros (1,5));
p3 = cat(2, zeros(1,5), zeros (1,5), ones(1,5), zeros (1,5));
p4 = cat(2, zeros(1,5), zeros (1,5), zeros (1,5), ones(1,5));
P = cat(1,p1,p2,p3,p4);
Y = cat(2, eye(5), eye(5), eye(5), eye(5));
Qeq = cat(1, P, Y);
[x, fval] = linprog (C, [], [], Qeq, b, lb);
No feasible solution found.
Linprog stopped because no point satisfies the constraints.

採用された回答

Matt J
Matt J 2021 年 5 月 3 日
編集済み: Matt J 2021 年 5 月 3 日
You have provided equality constraints that have no solutions, as can be seen by:
rank(Qeq)
ans = 8
rank([Qeq,b.'])
ans = 9

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by