Clear Filters
Clear Filters

Problem is unbounded in linear programming

21 views (last 30 days)
I have this solution for a linear programming . I have used the linprog function , but I get showed the answer : Problem is unbounded .
Please if you can help me how to fix this problem .
The code is below :
AT = [1 4 2 3;
4 5 3 1];
u = [300 400];
g = [320 510 430 300];
z = linprog(g,AT,u);
  2 Comments
Chendi Lin
Chendi Lin on 9 Apr 2021
Hi Klaus,
Is there any missing lower bound or upper bound for the design variables?
For example, if all your design variables are non-negative, then you will have
lb = zeros(4,1);
ub = [];
z = linprog(g, AT, u, [], [], lb, ub);
Please refer to this document to see the syntax for linprog: Solve linear programming problems - MATLAB linprog (mathworks.com).
Thanks,
CD
Klaus Hajdaraj
Klaus Hajdaraj on 9 Apr 2021
Thank your for your answer !
Yes , I expect only positive values , but when I try the code with ub and lb like you suggested me , the result is 0 0 0 0.
I expect a different result , postitive non zero numbers.

Sign in to comment.

Answers (1)

Chendi Lin
Chendi Lin on 9 Apr 2021
Edited: Chendi Lin on 9 Apr 2021
Hi Klaus,
Because all your design variables are non-negative, you will have
AT = [1 4 2 3;
4 5 3 1];
u = [300 400];
g = [320 510 430 300];
lb = zeros(4,1);
ub = [];
z = linprog(g, AT, u, [], [], lb, ub);
Notice that, linprog solves a minimization problem. Intuitively, the result is a zero vector. To make it a maximization problem, you can use
z = linprog(-1*g, AT, u, [], [], lb, ub);
And the result is [0; 0; 128.57; 14.29] now.
Please refer to this document to see the syntax for linprog: Solve linear programming problems - MATLAB linprog (mathworks.com).
Thanks,
CD

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!