Please help me fill out the fuction format for below question...
<Question>
Objective:
Max: 6 x1 + 5 x2 + 4 x3 + 5 x4 + 6 x5
Constraints:
x1 + x2 + x3 + x4 + x5 <= 3
5x1 + 4x2 + 3x3 + 2x4 + x5 <= 14
x1、 x2、x3、x4、x5 >= 0
<Function>
__________________________________________________ ___
function vert = feassol(A,b)
[m,n] = size(A);
b = b( : );
vert = [];
if n<m,
error('More equations greater than number of variables');
else
nv = nchoosek(n,m);
t = nchoosek(1: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
end
if ~isempty(vert)
vert = delcols(vert);
else
vert = [];
end
__________________________________________________ _____________
Thanks!
![]()


LinkBack URL
About LinkBacks