Linprog to maximise a function

1 回表示 (過去 30 日間)
Ivan
Ivan 2014 年 12 月 5 日
コメント済み: Ivan 2014 年 12 月 5 日
Hello. I think, that I did a mistake in my program for maximize x8. I have a function: fx= -0.818x1 + 0.241x2 + 4.737x3 + 0.2x4 + 0.483x5 - 0.02x6 + 0.06x7 I made restriction for my resulting variable: it cant be more, than 100. And i have some other resrictions, which you can see in my cod. _________________________________________________________________
C = [-0.818 0.241 4.737 0.2 0.483 -0.02 0.06];
D = [-0.818 0.241 4.737 0.2 0.483 -0.02 0.06];
B = [100];
% Aeq = [1 -1 1];
% beq = [0];
lb = [22 52 3.5 12 105 300 800];
ub = [40 80 5.9 22 150 700 1200];
f = C;
A = D;
b = B;
[x,fval] = linprog(-f,A,b,[],[],lb,ub);
x
fval
____________________________________________________________________________
I got the result fval = -100 - is good, but when i change my restrictions - result still 100, only x changes. Maybe it's good, but I don't know it, or it's a code mistake.

採用された回答

John D'Errico
John D'Errico 2014 年 12 月 5 日
編集済み: John D'Errico 2014 年 12 月 5 日
You are maximizing f(x), subject to the constraint that f(x) cannot be larger than 100.
There are far too few constraints on x, except that the vector must lie with a rather large hyper-rectangle, and that f(x) must not exceed 100. So you can have a huge (infinite) variety of solutions, all of which will yield exactly 100 for f(x).
Change the bounds, who cares? You can still get f(x) == 100 in a different way. Were you to change the bounds on x by too much, eventually you can end up with a system with no solution at all.
Why is this even remotely surprising? It seems to have worked.
  1 件のコメント
Ivan
Ivan 2014 年 12 月 5 日
thanks!

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by