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

📄 squence.asv

📁 炼钢浇注的时序规划算法
💻 ASV
字号:


%%

function [output]  =  squence(n,m,a,b)

%%%%
all_result   =   nchoosek(1:n+1,m);     %all the possible solutions
[col,row]    =   size(all_result);      % the size of all_result

Cat_col_A      =   (n+1)*ones(col,1);    
Cat_col_B      =   ones(col,1);


dis_A        =   cat(2,all_result,Cat_col_A);
dis_B        =   cat(2,Cat_col_B,all_result);
difference_matrix      =      abs(dis_A  - dis_B);   %the numbers of white balls between every two black balls


% test the solutions in dismantle_matrix whether statify the constrians of
% a and b ;

logic_res    =    difference_matrix>=a  &   difference_matrix <= b;
sum_res      =    (sum(logic_res'))';

index  = 1;
for k  = 1: col
    if difference_matrix(k,1) == 0  &  sum_res(k)==m
        result(index,:)  =  difference_matrix(k,:);
        index = index + 1;
    end
    
    if difference_matrix(k,m+1) == 0  &  sum_res(k)==m
        result(index,:)  =  difference_matrix(k,:);
        index = index + 1;
    end
    
    if sum_res(k)>m;
        result(index,:) = difference_matrix(k,:);
        index = index + 1;
    end
end
        
[col_result,row_result]   =   size(result);


%%output

output        =         ones(col_result,m+n);


for     m_col  =  1:  col_result
    for    n_row = 1:  row_result-1
        
        if result(m_col,n_row)  ==  0
                output(m_col,n_row)  =   0;
        else
                output(     m_col,   sum(    result(m_col,1:n_row))  +  n_row     ) = 0;
        end
    end
end
     
for  i  =  1: col_result
    for   j  =  1: 



%save('result.txt','output','-ascii');
dlmwrite('result.txt',output,' ')      

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -