Using linprog but it's only returning 'Optimal solution found' with no feasible solution?
조회 수: 5 (최근 30일)
이전 댓글 표시
This is my first time using MATLAB and I'm so confused. This is my input:
f = [-4000 -5000];
A = [6 5;
4 6;
-6 -5;
-9 -5;
-1 0;
0 -1];
b = [500 400 -300 -200 0 0];
Aeq = [];
beq = [];
X = linprog(f,A,b,Aeq,beq)
As you can see, all I get in return is "Optimal solution found." Is there something I'm missing possibly? I feel like it should be easy, but like I said I've never used MATLAB.
댓글 수: 1
답변 (1개)
Bruno Luong
2022년 9월 5일
편집: Bruno Luong
2022년 9월 5일
It looks solution is correct to me.
Note that the Aeq = [] meaning you don"t supply equality constraint, so I need to check for inquelity constraints of the solution and the constraints are satisfied as showed here:
f = [-4000 -5000];
A = [6 5;
4 6;
-6 -5;
-9 -5;
-1 0;
0 -1];
b = [500 400 -300 -200 0 0];
Aeq = [];
beq = [];
X = linprog(f,A,b,Aeq,beq)
A*X-b(:)
all(A*X<=b(:))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!