Sunday, October 11, 2009

matlab : example program to find extreme points of lp problem



format compact;
A=[2 1 1 1 0 0; 1 -2 1 0 1 0; 1 1 0 0 0 1];

b = [ 10; 8; 3];
c= [-1 1 1 0 0 0];

n = 3;
m = 3;

i = 1;
while i <= n+1
j = i+1;
while j < n+m
k=j+1;
while k <=n+m
B=[A(:,[i j k]) b];
B=rref(B);
temp = [ 0 ; 0 ; 0; 0; 0; 0];
x = B(:,[n+1]);
fprintf(1,'***Is feasible __ ***');
fprintf(1,'i=%d,j=%d,k=%d \n',i,j,k);
temp(i) = x(1);
temp(j) = x(2);
temp(k) = x(3);
temp
c*temp
B=0;
x=0;
k=k+1;

end
j=j+1;
end
i=i+1;
end

No comments:

Post a Comment