Effacer les filtres
Effacer les filtres

Solving Linear Programming Problem (LPP) in MATLAB

3 vues (au cours des 30 derniers jours)
SUSHMA MB
SUSHMA MB le 15 Juin 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)

Réponses (0)

Catégories

En savoir plus sur Quadratic Programming and Cone Programming dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by