If you want the condition x1 + x2 + x3 = 1, then you need:
[x,value]=linprog(f,A,b,[1 1 1],[1],lb)
hi all,
can anyone help me with this?ive been stuck for days!
im using the matlab code:
%
options=optimset('LargeScale','off','Simplex','on' );
%
% This code solves the problem:
%
% minimise x_1+x_2+x_3
%
% subject to the constraints
%
% b_11 x_1 + b_12 x_2 + b_13 x_3 >= 1
% b_21 x_1 + b_22 x_2 + b_23 x_3 >= 1
% b_31 x_1 + b_32 x_2 + b_33 x_3 >= 1
% x_1 >=0, x_2 >=0, x_3 >=0
%
%
B=[ 1 -6 -7;
-1 6 6;
7 -6 0];
A=-B;
f=[1;1;1];
b=-[1;1;1];
lb=zeros(3,1); % x_1, x_2 and x_3 are non-negative.
%
[x,value]=linprog(f,A,b,[],[],lb)
to solve for (see attached file)
my results are (when i run simplex_method.m):
x1 = 0
x2 = 0
x3 = 1/3
obviously this does not make any sense?? as x1 + x2 + x3 = 1
what am i doing wrong?? : (
P.S. im trying to minimise the problem in the second pic
i did that and now i got:
x =
1.4667
1.5134
0.0008
value = 2.9809
andi got a message saying:
exiting: one or more of the residuals, duality gap or total relative error has grown 10000 times greater than its minimum value so far: the primal appears to be infeasible (and the dual ubnounded)
There must be no minimum in the region either because the region is empty, or the region does not have a lower bound for x1+x2+x3.
Actually, I thought you wanted x1+x2+x3=1 as a constraint, but now that I think about it , this does not make sense as you want to minimize x1+x2+x3.
How do you know that the minimum is x1+x2+x3=1?
Isn't 0+0+1/3 = 1/3 less than that?
So you are trying to minimize -w?
How do you transform this into linear programming with x1,x2,x3?
Well look at the value of x1 + x2 + x3 + (-w) = 1 + (-w), and minimize this.
So now you should have a 4 variable vector (x1,x2,x3,-w).
Also, remember to express the constraint x1+x2+x3=1 (which is the same as 1*x1+1*x2+1*x3+0*(-w) = 1)