Why does linprog gives wrong answer?

Hi! My LP problem:
f=[-7 -5];
A=[2 3; 2 1; 0 3; 3 0];
b=[25 20 18 15];
linprog(f, A, b)
I've got:
ans =
5.0000
5.0000
But if I calculate it "by hands" I should've got ans=[5;10]. And my f should be =85 unstead of 60.
Why does it count wrong?

답변 (1개)

the cyclist
the cyclist 2015년 3월 14일

0 개 추천

I think your hand calculation is incorrect. x1=5 and x2=10 does not obey the first constraint, which requires that 2*x1 + 3*x2 <= 25.

댓글 수: 1

You are right:
x = [5;10];
[A*x b']
ans =
40 25
20 20
30 18
15 15
In other "words":
A*x<=b'
ans =
0
1
0
1
Titus

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Linear Programming and Mixed-Integer Linear Programming에 대해 자세히 알아보기

질문:

2015년 3월 14일

댓글:

2015년 3월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by