📄 isfeasible.m
字号:
function [b,r]=isFeasible(s,bk,l,d)
% realize a pop
%pop code of rount
%bk cap of truck
%l the num of shop
n=size(s,2); %num of element of s
nt=size(bk,2); % num of trucks
dz=zeros(1,l); % flag
nk=zeros(1,nt);% shop num at root K
r=zeros(nt,l);
for x=1:n
m=s(x)-(ceil((s(x)-l)/l))*l; %the m th shop
k=(ceil((s(x)-l)/l))+1; %the k th root
if dz(m)==0
if d(m)<=bk(k)
dz(m)=1;
bk(k)=bk(k)-d(m);
nk(k)=nk(k)+1;
r(k,nk(k))=m;
end
end
end
if all(dz)
b=1;
else
b=0;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -