Solving Linear Programming Problem (LPP) in MATLAB

조회 수: 2 (최근 30일)
SUSHMA MB
SUSHMA MB 2015년 6월 15일
I have a code for LPP mentioned below, but its showing some error which im not able to retify. Please help me with this.
function vert = feassol(A, b)
% Basic feasible solutions vert to the system of constraints
% Ax = b, x >= 0.
% They are stored in columns of the matrix vert.
[m, n] = size(A);
warning off
b = b(:);
vert = [];
if(n >= m)
t = nchoosek(1:n,m);
nv = nchoosek(n,m);
for i=1:nv
y = zeros(n,1);
x = A(:,t(i,:))\b;
if all(x >= 0 & (x ~= inf & x ~= -inf))
y(t(i,:)) = x;
vert = [vert y];
end
end
else
error('Number of equations is greater than the number of
variables.')
end
if ~isempty(vert)
vert = delcols(vert);
else
vert = [];
end
I want to run the problem, example : x1 + x2 <= 6, x2 <= 3 and x1, x2 >= 0. The constraint matrix A and the right hand sides b are A = [1 1 1 0; 0 1 0 1]; b = [6; 3]; vert = feassol(A, b)

답변 (0개)

카테고리

Help CenterFile Exchange에서 Quadratic Programming and Cone Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by