How to set upper bounds for linear programming?

18 ビュー (過去 30 日間)
ErikR
ErikR 2016 年 5 月 7 日
回答済み: John D'Errico 2016 年 5 月 7 日
Hi,
I am trying to solve a problem using linear programming, that is maximize something. This problem has upper and lower bounds. The lower bounds are all zero, but the upper bounds differ.
I've tried to follow and do as they do in this guide: GUIDE. The problem with that is that I get the following error message: Warning: Length of upper bounds is > length(x); ignoring extra bounds. When I did this, I was using the linprog solver.
So, I have set up my program as following:
I want to maximize Z
Z = 4P1 + 3P2 + 2P3 + 2P4 + P5
A = [2 0 0 0 0; 0 2 2 2 1; 0.2 1 0 0.5 0]
f = [-40000; -30000; -20000; -20000; -10000];
b = [36000; 216000; 18000];
lb = zeros(5,1);
Now, I want to use an upper bound as well. The upper bounds look like this:
P1 <=16000, P3 <= 2000, P1+P2+P3 <= 34000, P4+P5 <= 28000
All P1-P5 are greater than, or equal to zero.
How should I formulate the upper bound?
Thanks in advance.

回答 (1 件)

John D'Errico
John D'Errico 2016 年 5 月 7 日
These are NOT upper bounds.
P1+P2+P3 <= 34000, P4+P5 <= 28000
They are linear inequality constraints. A linear inequality constraint acts on a linear combination of the unknowns.
These are upper bounds.
P1 <=16000, P3 <= 2000,
As you see, a bound constraint acts on ONE variable, limiting that single variable from below or above. Otherwise, you could argue that ALL inequality constraints were bound constraints.

カテゴリ

Help Center および File ExchangeLinear 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!

Translated by