2

I want to solve this linear programming (simplex) problem using MATLAB 7, but it returns

Exiting: the problem is unbounded.

This function

f = 2(15 s0 + 8s1 + 2576s2 + 744s3 + 427s4 + 8s5)

Should be minimized in such a way that two constraints for each observation are satisfied

0.1s0 + 0.1s1 + 14.5s2 + 4s3 + 2.4s4 – a0 − a1 − 145a2 − 40a3 − 24a4 ≥ −2.2

0.1s0 + 0.1s1 + 14.5s2 + 4s3 + 2.4s4 + a0 + a1 + 145a2 + 40a3 + 24a4 ≥ 2.2

S5 and a5 are 0. I used

f = [15   8  2576  744  427 8   15   8  2576 744  427 8];

b = [-2.2; 2.2];

a = [0.1  0.1 14.5  0.4  2.4 0 -1 -1  -145 -40 -24 0 ; 0.1  0.1 14.5  4  2.4 0 1  1   145  40  24 0]; 

[x, fval, exitflag, output, lambda] = linprog(f, a, b)

What is the right way to solve this problem?

1 Answer 1

3

You didn't constrain your s5 and a5 to actually be zero, since you set the corresponding coefficients in the a matrix to zero. Thus, they can take on any value, and the LP is unbounded.

To fix, add an equality constraint:

beq = [0; 0];
aeq = [0 0 0 0 0 1 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 1];
[x,fval,exitflag,output,lambda] = linprog(f,a,b,aeq,beq)

Or, just drop s5 and a5 from the LP since they don't contribute at all.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you nneonneo, it works. But the coefficients are way to high! (hunch)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.