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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by