📄 l01p_e.m
字号:
% the programm is with the integer 0-1 programming use enumber method
function [x,f]=L01p_e(c,A,b,N)
% the function is use the enumber function
% 0-1 linear programming problem
% min f=c'*x,s.t.A*x<=b,x=0 or 1
% N is the number of equational constraints in the front of the constraints
% x is the optimal solution and the f is the optimal value
if nargin<4
N=0;
end
c=c(:);
b=b(:);
[m,n]=size(A);
x=[];
f=abs(c')*ones(n,1);
i=1;
while i<=2^n
B=transdetobi(i-1,n)';
t=A*B-b;
t11=find(t(1:N,:)~=0);
t12=find(t(N+1:m,:)>0);
t1=[t11;t12];
if isempty(t1)
f=min([f,c'*B]);
if c'*B==f
x=B;
end
end
i=i+1;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -