Untitled
Anonymous
plain_text
02/18/2026 7:56 AM
848 B
9
Indexable
A= [-6 7 -7 -9 -1; 1 1 -1 4 0]
B = [4; 10]
C = [2 3 -3 5 0]
n = size(A, 2)
m = size(A, 1)
if(n > m)
ncm = nchoosek(n, m)
pair = nchoosek(1:n, m)
sol = []
for i = 1:ncm
y = zeros(n, 1)
x = A(:, pair(i, :))\B
if all(x >= 0 & x~= inf & x~= -inf)
y(pair(i,:)) = x
sol = [sol y]
end
end
z = C*sol
[zmax, zindex] = max(z)
bfs = sol(:, zindex)
optimal.value = [bfs' zmax]
optimal.bfs = array2table(optimal.value)
optimal.bfs.Properties.VariableNames
else
error('ncm does not exist')
endEditor is loading...
Leave a Comment