How can I add innequalities to a minimum cost-flow problem?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello everyone. I have the following optimization code:
f =[2 , 4 , 9 , 3 , 1 , 3 , 2 ] ;
Aeq=[1 1 1 0 0 0 0
-1 0 0 1 0 0 0
0 -1 0 -1 1 0 0
0 0 -1 0 0 1 -1
0 0 0 0 -1 -1 1 ] ;
Beq=[50; 40 ; 0 ; -30; -60] ;
lb =[0 0 0 0 0 0 0 ] ;
ub=[10 inf inf inf 80 inf inf] ;
intcon =[1 ,2, 3, 4, 5, 6, 7 ] ;
[x, v, s]= intlinprog( f, intcon, [], [], Aeq , Beq , lb , ub )
This code represents a minimum cost-flow problem in which, the same amount of product goes from two sources to two desiny nodes as per the attached image called problem.PNG. However, my slides say that if there is an excess of demand, (E demands 70 units instead), the conditions on nodes D and E would be:
from And from
I have tried to implement this by introducing A and B as:
f =[2 , 4 , 9 , 3 , 1 , 3 , 2 ] ;
Aeq=[1 1 1 0 0 0 0;
-1 0 0 1 0 0 0;
0 -1 0 -1 1 0 0] ;
A=[0 0 -1 0 0 1 -1;
0 0 0 0 -1 -1 1];
B=[-30; -70];
Beq=[50; 40 ; 0] ;
lb =[0 0 0 0 0 0 0 ] ;
ub=[10 inf inf inf 80 inf inf] ;
intcon =[1 ,2, 3, 4, 5, 6, 7 ] ;
[x, v, s]= intlinprog( f, intcon, A, B, Aeq , Beq , lb , ub)
Unfortunately, as it can be seen, I obtain unfeasible as result.
Can someone please tell me if they can spot my mistake?
Best regards.
댓글 수: 7
Torsten
2022년 7월 16일
Yes, what arrives in D must be less or equal 30, not greater or equal 30, and what arrives in E must be less or equal 70, not greater or equal 70. If you use >= in both cases, you cannot satisfy this demand because in sum it would be >=100, but as supply you only have 90 to distribute among D and E.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Programming and Mixed-Integer Linear Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!