⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdynamic.m

📁 清华大学运筹学课件
💻 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 + -