📄 sdynamic.m
字号:
% the program is with the scheduling problem in the dynamic programming
% please input the scheduling matrix
input('the program is with the scheduling problem in the dynamic programming')
m=2;
n=input('Please input the number=')
S=input('Please input the scheduling matrix S(m,n)=')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:n
opt_schedule(i)=0;
end
for k=1:n
mintemp=S(1,1);
for i=1:m
for j=1:n
if S(i,j)<mintemp
mintemp=S(i,j);
end
end
end
for i=1:m
for j=1:n
if S(i,j)==mintemp;
linetemp=i;
columntemp=j;
end
end
end
if linetemp==1
i=1;
while 1
if opt_schedule(i)==0
opt_schedule(i)=columntemp;
break
end
i=i+1;
end
elseif linetemp==2
i=n;
while 1
if opt_schedule(i)==0
opt_schedule(i)=columntemp;
break
end
i=i-1;
end
end
for i=1:m
S(i,columntemp)=1000;
end
end
opt_schedule
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -