Borrar filtros
Borrar filtros

Solving Linear Programming Problem (LPP) in MATLAB

3 visualizaciones (últimos 30 días)
SUSHMA MB
SUSHMA MB el 15 de Jun. de 2015
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)

Respuestas (0)

Categorías

Más información sobre Quadratic Programming and Cone Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by